I have this below macro that runs fine for when xrow=1 to 99, but as soon as I put in anything over 100 it keeps generating this error that I don't understand.
ERROR: Invalid value for width specified - width out of range
NOTE: At least one W.D format was too small for the number to be printed. The decimal may be shifted by the "BEST" format.
I looked up some helpful articles that say it may be a format issue, but I am not sure what format I would need to allow it to read > 100 and all the ones I have tried have not worked. Any help is much appreciated!! Thank you!
%Macro MYC(xdata,xrow);
proc sql noprint;
select filter,biomarks, group, exclude, number, title,
strip("TAB"||strip(put(ID,z2.))||"A") as tab, strip("Table "||strip(number)||": "||strip(title)) as ftabtitle,
strip(tranwrd(title,'Endpoints – ',' ')) as stabtitle
into: xfilters, :xbiomark, :xgroup, :xexclude, :xtabnum, :xtabtitle, :xtab, :xftabtitle, :xstabtitle
from input.data
where ID = &xrow;
quit;
%mend MYC;
%MYC(input.data_new,100);
Buried in your select statement is the expression:
put(ID,z2.)
which precedes the clause
where ID = &xrow;
So your macro call
%MYC(input.data_new,100);
means that the put(ID,z2.) will attempt to write the value 100 in a 2-digit character space. Change the z2. to a format that can accommodate the 3-digit value of 100.
Buried in your select statement is the expression:
put(ID,z2.)
which precedes the clause
where ID = &xrow;
So your macro call
%MYC(input.data_new,100);
means that the put(ID,z2.) will attempt to write the value 100 in a 2-digit character space. Change the z2. to a format that can accommodate the 3-digit value of 100.
Thank you so much, I definitely missed that! Works perfectly now!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.