Hi there,
Here I have a situation that I am anticipating variables A to Z in dataset, if we have any variable missing in a resultant dataset then need to initialize that missing variable with a missing value
example: Expecting A B C D E F G variables in data set, but I got only A B C F variables in a resultant dataset in this case I need to initialize missed out variables D E G with missing value in the resultant dataset.
Any help would be very much appreciated and helps me very much
Thanks in advance
Manoj
Create a blueprint dataset without observations, and prepend that in a SET statement to the actual data:
data expect;
input a b c d e f g;
datalines;
;
data have;
input a b c f;
datalines;
1 1 1 1
2 2 2 2
;
data want;
set
expect
have
;
run;
Create a blueprint dataset without observations, and prepend that in a SET statement to the actual data:
data expect;
input a b c d e f g;
datalines;
;
data have;
input a b c f;
datalines;
1 1 1 1
2 2 2 2
;
data want;
set
expect
have
;
run;
Hi there,
Here I have a situation that I am anticipating variables A to Z in dataset, if we have any variable missing in a resultant dataset then need to initialize that missing variable with a missing value
example: Expecting A B C D E F G variables in data set, but I got only A B C F variables in a resultant dataset in this case I need to initialize missed out variables D E G with missing value in the resultant dataset.
Any help would be very much appreciated and helps me very much
Thanks in advance
Check this link
https://communities.sas.com/t5/SAS-Programming/Assign-variable-with-missing-valuesd/m-p/672750
Then check to see if you can guess who in your class the other poster may be.
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.