DATA Step, Macro, Functions and more

%let and numeric

Reply
Super Contributor
Posts: 648

%let and numeric

The following %let statement goes through iterations.How to convert the macro variables to numeric?

%LET VGROUP&I = "&&GROUP&I";
Super User
Posts: 17,963

Re: %let and numeric

Macro variables are always stored as characters.

If you want it resolved to numeric you can apply a format where you would resolve the variable, using sysfunc and inputn functions.

See
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#z3514sysfunc.htm

HTH
SAS Super FREQ
Posts: 8,745

Re: %let and numeric

Hi:
And, as an additional comment, it is hardly ever a good idea to "prequote" macro variables in a %LET statement. In the code snippet that you showed, the macro variable would contain the resolved value of &&GROUP&I, including the quotes. This may or may not be appropriate and could cause quoting problems depending on your usage of &VGROUP1, &VGROUP2, etc.

cynthia
Ask a Question
Discussion stats
  • 2 replies
  • 221 views
  • 0 likes
  • 3 in conversation