10-24-2014 08:16 AM
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.
21 output out=Data sum=DATA_TOTAL;
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
10-24-2014 10:59 AM
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.
10-26-2014 08:12 PM
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 */
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.