Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I see what the formats are?

Status
Not open for further replies.

jonnysnow

Programmer
Apr 10, 2003
36
US
I received a dataset with built-in formats. How can I print out a listing of the raw values together with formatted values?

Thanks!
 
I would create a new variable with no format then do a de-dupe and print.

This should do it, you may need to play around with it a little:-

data test;
set inpt_file;

*oldvar is the formatted variable *;
*newvar will be unformatted *;

newvar = oldvar;
run;

* Dedupe by both variables as there may be ranges *;
* being used *;
proc sort data=test nodupkey;
by oldvar newvar;
run;

proc print data=test noobs label;
var oldvar newvar;
label oldvar="Formatted Value"
newvar="Data value";
run;
 
Sounds like a good idea. But I want to know ALL the values in the format, not just the ones that appear in my data.

I would guess this solution would be something along the lines of looking into the catalog with the formats??? But I don't know anything about catalogs. Any ideas, anyone?
 
To get all the formats you would use the proc format in the following way.

PROC FORMAT LIB=YOUR_LIB FMTLIB;
RUN;

This prints out all the values of a format in a format library. NOw if you want to match this data with your variables you can use the Proc contents results along with the above results. Let me know if you want to do that.

I hope that this helps.
Klaz
 
or you can simpley use the content prodecure or datasets procedure...

proc contents data= sashelp.class out =_info;
run

the _info dataset provides detailed information on the variables, formats and informats ect.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top