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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 2258 views
  • 0 likes
  • 3 in conversation