Help using Base SAS procedures

format table confusion

Accepted Solution Solved
Reply
Super Contributor
Posts: 259
Accepted Solution

format table confusion

I have the following format table....

start label fmtname type

dev_cumul1 1.43167 devfactors I

dev_cumul2 0.9861 devfactors I

dev_cumul3 0.98054 devfactors I

dev_cumul4 0.99966 devfactors I

dev_cumul5 1.0261 devfactors I

dev_cumul6 1.03256 devfactors I

dev_cumul7 1.00784 devfactors I

dev_cumul8 1.00418 devfactors I

dev_cumul9 1.01717 devfactors I

dev_cumul10 1.02158 devfactors I

dev_cumul11 1.01234 devfactors I

dev_cumul12 1.01011 devfactors I

dev_cumul13 0.98893 devfactors I

dev_cumul14 0.96408 devfactors I

dev_cumul15 0.97264 devfactors I

dev_cumul16 0.96371 devfactors I

dev_cumul17 0.97068 devfactors I

dev_cumul18 0.983 devfactors I

dev_cumul19 1.00195 devfactors I

dev_cumul20 1.00208 devfactors I

I was testing whether I could read in the values from this table and I included one value not listed in the 'start' column of the format table (dev_cumul100). However, the dataset test1 reads in a value for this? The output is given below the code:

data test;
input flag1 $14.;
datalines;
dev_cumul1
dev_cumul4
dev_cumul8
dev_cumul16
dev_cumul100

run;

data test1;
set test;
dev_factor = input(flag1,devfactors.);
run;

flag1 dev_factor

dev_cumul1 1.431666437

dev_cumul4 0.99965594

dev_cumul8 1.004175057

dev_cumul16 0.96371087

dev_cumul100 1.02158079

I would have thought the value for dev_cumul100 would be . since it's not on the format table.


Accepted Solutions
Solution
‎08-05-2015 11:47 AM
Respected Advisor
Posts: 3,799

Re: format table confusion

The problem is the default W(idth) of the user defined informat.  Notice that the value for dev_cuml100 is the same as dev_cuml10.  Add w value to devfactors that is ge to the length of longest flag1, 11 I think.

View solution in original post


All Replies
Solution
‎08-05-2015 11:47 AM
Respected Advisor
Posts: 3,799

Re: format table confusion

The problem is the default W(idth) of the user defined informat.  Notice that the value for dev_cuml100 is the same as dev_cuml10.  Add w value to devfactors that is ge to the length of longest flag1, 11 I think.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 232 views
  • 0 likes
  • 2 in conversation