Hi!
I have a SAS file of 200 zones. In each zone, there are 150 houses. I then have a binary event variable.
I do not have info on all the houses but need to fill in the missing values and put event= '.'
Like for zone 0, I am missing house 4,5,6,7, the values between 8-30, etc. Is there a way I can add these missing values for each of the zones in SAS?
I hope this question makes sense!
the picture is how it looks now:
We know that there are 150 houses per zone.
So houses are labeled 0 to 150 and how many zones do you have?
Probably the simplest way is to build an empty table and merge into it.
data skeleton;
do zone=1 to 200;
do house=1 to 150;
output;
end;
end;
run;
data want;
merge skeleton have;
by zone house;
run;
A bunch of other options are outlined in this document, some are easier, some are harder.
https://www.lexjansen.com/pharmasug/2005/CodersCorner/cc22.pdf
I already have this file imported into SAS.
We know that there are 150 houses per zone. So for the houses with missing info: I need it to say zone 0, hour 4, accident "." (to indicate that it's missing).
We have information for a lot of the houses, but need to indicate missing for the ones that aren't listed in the file.
We know that there are 150 houses per zone.
So houses are labeled 0 to 150 and how many zones do you have?
Probably the simplest way is to build an empty table and merge into it.
data skeleton;
do zone=1 to 200;
do house=1 to 150;
output;
end;
end;
run;
data want;
merge skeleton have;
by zone house;
run;
A bunch of other options are outlined in this document, some are easier, some are harder.
https://www.lexjansen.com/pharmasug/2005/CodersCorner/cc22.pdf
Thank you! I appreciate it!
Can't do any testing with a picture.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.