Hello,
I am trying to make a code that can help me recategorize my tables. The variables that will be conditioned are: Province and City. Basically, if Province is = to Toronto and the Province is Ontario, i'd like the region to be categorized as "Toronto". If province is = to Ontario and city is NOT equal to toronto, id like region to be categorized as "outside of toronto".
Here is the code I have:
data work.tester2;
if province="ON" and city="torontp"
then
Region="Toronto";
else if province= "ON" and city^="toronto"
then Region="outside of toronto";
end;
run;
when I run this code, all fields go blank.
Thanks
Ah, you aren't reading any data in. You need a SET statement to read in an existing SAS dataset.
Try removing your END statement and can only be used with a matching DO statement which you don't have.
Check your SAS log for errors. What does it say?
Ah, you aren't reading any data in. You need a SET statement to read in an existing SAS dataset.
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.