Hello Everyone,
Please suggest me and correct me why my flag(match1,match2 and match3) is showing as missing value.
i just need if the Freq_hist_201210 data matches Source_201210 then mark match1 as true else false
again if Freq_hist_201211 data matches Source_201211 then mark match2 as false and so on.
In my coding it is giving missing value:(
data val;
infile datalines;
input hist $16. Source $14.;
datalines;
Freq_hist_201210 Source_201210
Freq_hist_201211 Source_201211
Freq_hist_201212 Source_201212
;
run;
Proc sql;
select hist into : a separated by ' ' from val;
select Source into : b separated by ' ' from val;quit;
%put &a. &b.;
Data validation;
set summary2;
Array aa(*) &a.;
Array bb(*) &b.;
Array match(3) ;
Do i=1 to dim(aa);
if aa(i)=bb(i) then match(i)="true";
else match(i)= "false";
end;
run;
All the variables are numeric, including Match1, Match2, and Match3. So they can't hold "true" or "false". Try defining them as character instead:
array match {3} $ 5;
And be sure to pay attention to the log when it talks about character to numeric conversion. That can be a clue.
Are these numerical variables? What does the log say, and what does your data look like?
My guess - numerical precision mismatch - maybe need to round?
Verify your macro variables are resolving properly. Hard code it in, if necessary, and test it.
thankyou Reeza,
yes these are all numeric variable and also macros is resolving correctly.
taking as numerical precision mismatch then it should mark as "false" which either is not working. 😞
All the variables are numeric, including Match1, Match2, and Match3. So they can't hold "true" or "false". Try defining them as character instead:
array match {3} $ 5;
And be sure to pay attention to the log when it talks about character to numeric conversion. That can be a clue.
yeah my mistake i forgot to mention $ 😞
Thankyou Astounding ..you are awesome.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.