BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

Following macro code only seemed to work if the dollar format was exact. That is, the dollar ranges were <$400, $400-$1000, and over $1000.  For the dollar format, if I put “dollar4.” for the $400 macro variable and “dollar5.” for the $1000 macro variable everything worked great.  But if I used “dollar5.” and “dollar6.” I would get the error message as below. Appreciate if someone guide me to come past this issue.

 

 

proc format;
value spnd&k.lbl    1 = &ls_lbl.
                    2 = &ms_lbl.
       		    3 = &hs_lbl.
     			          ;
run;

Log:

 

.

SYMBOLGEN:  Macro variable K resolves to 2
SYMBOLGEN:  Macro variable LS_LBL resolves to Less than  $400
SYMBOLGEN:  Macro variable MS_LBL resolves to  $400 to $1,000
ERROR: This range is repeated, or values overlap: 1-1.
SYMBOLGEN:  Macro variable HS_LBL resolves to More than $1,000
NOTE 137-205: Line generated by the invoked macro "RUNREPORTS".
141         row_nbr = &k.;  quit;      proc format;   value trip&k.lbl    1 = &lt_lbl.                       2 = &mt_lbl.
141      !     3 = &ht_lbl.              ;   value spnd&k.lbl    1 = &ls_lbl.                       2 = &ms_lbl.               3 =
                                                                                                                               _
                                                                                                                               22
141      ! &hs_lbl.
ERROR 22-322: Syntax error, expecting one of the following: (, ',', -, <, =.  

 

1 REPLY 1
ballardw
Super User

Try

proc format;
value spnd&k.lbl    1 = "&ls_lbl."
                               2 = "&ms_lbl."
       		               3 = "&hs_lbl."
     			          ;
run;

Without the quotes the second value fo &ms_lbl is interpreted as a new value not the display value.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 860 views
  • 1 like
  • 2 in conversation