- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
hi,
length ab 8
format ab BEST15.
informat ab BEST15.
ab variable is a part of Input_Data
16 proc summary data=Input_Data;
17 by GENERAL_LEDGER_NUMBER EXCO_CODE COMPANY_DIVISION_CODE;
18 var ab;
ERROR: Variable ab in list does not match type prescribed for this list.
19
20
21 output out=Data sum=DATA_TOTAL;
22 run;
I need your help on this how to resolve this.I tried format statement as well as input not working...can you provide tested code..Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Format won't change a variable from character to numeric. The variables on the VAR statement in Proc Means/Summary must be numeric in the input dataset. The values may look numeric but I bet if you run Proc contents on your Input_data set that it will show variable ab as character.
And if there are actually 15 digits you're possibly going to run into precision limitations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Agree with - sounds like your "AB" variable is character, in which case your data step will need to convert it to a numeric using the input() function.
data MyOutputData;
set MyInputData; /* Which contains the (presumably character) variable AB */
format ab BEST15.; /* Your choice of format is actually irrelevant for this exercise */
ab_num = input(ab,best15.); /* Note: The INFORMAT you choose will depend on the character "layout" - I've guessed BEST. here);
drop ab; /* Optional */
run;
proc summary..... etc.
If this does not help, please post the results of a PROC CONTENTS, plus the first few rows of a PROC PRINT of the AB variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you all for your valuable comments...I got the clue..its resolved now
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Could you please share your final result?