BookmarkSubscribeRSS Feed
MarcTC
Obsidian | Level 7
What is F10.4 format? I can't find any web page in SAS explaining this format.


Second, a dataset has user defined formats attached to some variables. How to "decode" these user defined formats?


Thanks in advance!
13 REPLIES 13
deleted_user
Not applicable
Hi, MarcTC.
for qustion 2;
you can specify 'format (var);'
here's a example.
data test;
input a @@;
format a dollar5.1;
cards;
1 2 3
;
run;
proc print;
run;
data akari;
set test;
format a;
run;
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Decoding a user-defined SAS format: check the PROC FORMAT documentation, you have either CNTLOUT= (then PROC PRINT) or more simply you can use FMTLIB to print the contents of a SAS format.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

proc format fmtlib site:sas.com
MarcTC
Obsidian | Level 7
I only have a SAS dataset, no original Catalog which created the user-defined formats used in the dataset. Isn't FMTLIB only applied for Catalog only?

Here is a more detailed description about my dataset:

The data looks like:

Student Rank
Tom Top 10
Mary Top 20
Joe Top 10
Nancy Top 30

Rank is a numeric variable, but associated with a user-defined format. That is why you see those strings Top 10, Top 20.. when viewing the dataset. I want to know what are the underlying numeric values corresponding to each string. That is what I meant by "decoding a format".
Cynthia_sas
SAS Super FREQ
Ah, that's not how I interpreted "decode". To "remove" a user-defined format for the purpose of running a report, you can use a NULL format statement, such as shown below. Basically, you list the variable on a FORMAT statement and then do NOT put a format name after the variable name.

cynthia
[pre]
proc print data=mydata;
format rank;
run;
[/pre]
MarcTC
Obsidian | Level 7
Hmm...you still don't get what I mean.


Suppose:

Rank=1 => being formated as "Top 10"
Rnak=2 => being formated as "Top 20"
Rank=3 => being formated as "Top 30"
....

I want to find out this relationship/mapping.
Cynthia_sas
SAS Super FREQ
That's what FMTLIB does -- it shows the mapping from the values to the label. If the FMTLIB is being used when you do a PROC PRINT (and the format shows up in a PROC CONTENTS), then FMTLIB will show the mapping, not exactly in the form you show, but close enough.

cynthia
MarcTC
Obsidian | Level 7
You are smarter and can read the SAS syntax page.


I tried several different combinations and nothing works. One of them is:

proc format library=work.mydataset fmtlib;
select $rank;
run;
Cynthia_sas
SAS Super FREQ
Hi:

OK..for your SAS dataset. If you run PROC CONTENTS, do you see that $RANK is listed as the format???

If yes, then try:
library=library or
library=work

in your PROC FORMAT statement. The chances are good that your folks who built the format took the default and stored the user defined format in a format catalog called "LIBRARY" or in "WORK" -- I know, it seems redundant to have LIBRARY=LIBRARY, but that's one of the "simple" ways that folks have defined their own format catalogs over the years.

You cannot put your dataset name in the LIBRARY= option.

If you run a PROC CONTENTS and do NOT see $RANK listed as the format being used for the field, then it is probable that the format used to create the RANK variable might not be available to you.

cynthia
Robert_Bardos
Fluorite | Level 6
Shouldn't the OP be looking for the numeric format RANK much rather?

I.e.

....
select rank ;
Cynthia_sas
SAS Super FREQ
A PROC CONTENTS should tell him whether the format is character or numeric and whether there is a format in current use. That's why I keep asking whether he's run PROC CONTENTS.

cynthia
Ksharp
Super User
Hi.
proc format + cnlout option to output the format contents into a dataset.
I remember it has mentioned by Art C at before post.


Ksharp
data_null__
Jade | Level 19
> What is F10.4 format? I can't find any web page in
> SAS explaining this format.

It appears that F is the name of the format most know as w.d

[pre]
203 data _null_;
204 x = 1;
205 format x 10.4;
206 format = vformat(x);
207 put 'NOTE: ' format=;
208 run;

NOTE: format=F10.4
[/pre]
Cynthia_sas
SAS Super FREQ
Hi:
As it shows here:
http://support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/viewer.htm#a000199377.htm

The "F" format is an alias for the simple w.d (width/decimal) that can be applied to numeric variables.

The whole list of formats by category is here:
http://support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/viewer.htm#a001263753.htm

To see a list of all the user-defined formats (or selected ones) stored in a format library, use the FMTLIB option with PROC FORMAT:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473464.htm

cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 13 replies
  • 3858 views
  • 0 likes
  • 7 in conversation