BookmarkSubscribeRSS Feed
jhaque
Calcite | Level 5

     

     

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

4 REPLIES 4
ballardw
Super User

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.

AndrewHowell
Moderator

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.

jhaque
Calcite | Level 5

Thank you all for your valuable comments...I got the clue..its resolved now

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 3136 views
  • 2 likes
  • 3 in conversation