I have towns in a dataset flagged with "*" or nothing (" ")
I want to create a new variable called location where "*"= "north" and " "= "south"
When I do this code, it codes " " to "south" but not "*" to "north"
data class4.water;
if flag="*" then location="north";
else if flag="" then location="south";
run;
Why is that happening? What can I do in my code to fix it?
This step works as it should. There is no SET statement, so no data is being brought in. I hope you have a way of re-creating CLASS4.WATER, because running this program just wiped it out, replacing it with a single observation and no data other than what you are observing.
This step works as it should. There is no SET statement, so no data is being brought in. I hope you have a way of re-creating CLASS4.WATER, because running this program just wiped it out, replacing it with a single observation and no data other than what you are observing.
need to post data so we can help.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.