BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ankitk321
Fluorite | Level 6

%let DATA_PULL_TYPE=NA/Dummy

%macro datapultyp_chng;

%let DATAPULLTYPES= %sysfunc(compress("&DATA_PULL_TYPE"," "));

%If %Upcase(&DATAPULLTYPES.) = BLINDED %then %do;

%let DataPullType= 'Real(BlindBreak)';

%end;

%else %If %Upcase(&DATAPULLTYPES.) = UNBLINDED %then %do;

%let DataPullType= 'Real(Unblinded)';

%end;

%else %If %nrstr(%Upcase(&DATAPULLTYPES.)) = NADUMMY %then %do;

%let DataPullType= 'NA/Dummy';

%end;

%put &DataPullType;

%mend datapultyp_chng;

%datapultyp_chng;

 

*I am geeting error in resolving the above mentioned code;

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Works for me.

--
Paige Miller

View solution in original post

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

post your log please

ankitk321
Fluorite | Level 6

     

 63         %let DATA_PULL_TYPE=NA/Dummy;

64        

 65         %macro datapultyp_chng;

66         %let DATAPULLTYPES= %sysfunc(compress("&DATA_PULL_TYPE"," "));

67         %If %Upcase(&DATAPULLTYPES.) = BLINDED %then %do;

68         %let DataPullType= 'Real(BlindBreak)';

69         %end;

70         %else %If %Upcase(&DATAPULLTYPES.) = UNBLINDED %then %do;

71         %let DataPullType= 'Real(Unblinded)';

72         %end;

73         %else %If %nrstr(%Upcase(&DATAPULLTYPES.)) = NADUMMY %then %do;

74         %let DataPullType= 'NA/Dummy';

75         %end;

76         %put &DataPullType;

77         %mend datapultyp_chng;

78         %datapultyp_chng;

MLOGIC(DATAPULTYP_CHNG):  Beginning execution.

MLOGIC(DATAPULTYP_CHNG):  %LET (variable name is DATAPULLTYPES)

SYMBOLGEN:  Macro variable DATA_PULL_TYPE resolves to NA/Dummy

SYMBOLGEN:  Macro variable DATAPULLTYPES resolves to NA/Dummy

ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:

        %Upcase(&DATAPULLTYPES.) = BLINDED

 ERROR: The macro DATAPULTYP_CHNG will stop executing.

MLOGIC(DATAPULTYP_CHNG):  Ending execution.

79        

 80         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

SYMBOLGEN:  Macro variable GRAPHTERM resolves to GOPTIONS NOACCESSIBLE;

PaigeMiller
Diamond | Level 26

Use

 

%if %qupcase(&datapulltypes) = BLINDED %then %do;

This is required if your macro variable (in this case &datapulltypes) contains certain special characters (in this case the slash)

--
Paige Miller
ankitk321
Fluorite | Level 6

No not working 😞

PaigeMiller
Diamond | Level 26

Works for me.

--
Paige Miller
ankitk321
Fluorite | Level 6

My bet, Thanks you are right its working. Thaks a ton for your help

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 6 replies
  • 1313 views
  • 0 likes
  • 3 in conversation