If your variable Parent1 is numeric (run PROC CONTENTS to check the type) and you see values that display as "L" in PROC PRINT or PROC FREQ, then the value is a numeric SPECIAL MISSING VALUE. See e.g.: https://documentation.sas.com/doc/en/lrcon/9.4/p1xr9fm7y8kek5n1hpj008tnu1a1.htm or the first SAS paper I wrote, 23 years ago: https://www.lexjansen.com/nesug/nesug01/ps/ps8009.pdf .
You can refer to the value in code like:
if Parent1=.L AND parent2=.L then employment=.L; *neither parent is alive;
If your variable Parent1 is numeric (run PROC CONTENTS to check the type) and you see values that display as "L" in PROC PRINT or PROC FREQ, then the value is a numeric SPECIAL MISSING VALUE. See e.g.: https://documentation.sas.com/doc/en/lrcon/9.4/p1xr9fm7y8kek5n1hpj008tnu1a1.htm or the first SAS paper I wrote, 23 years ago: https://www.lexjansen.com/nesug/nesug01/ps/ps8009.pdf .
You can refer to the value in code like:
if Parent1=.L AND parent2=.L then employment=.L; *neither parent is alive;
This worked. Thank you!
First you may want to share what you think you want to do with the "skip" variable.
I'm not seeing anything obvious for a variable named Employment what that would contribute to.
Second, do you see an L in the data set for either of those variables? If the variable is numeric and you see L then that means the variable has been assigned a special missing, which is a dot plus a letter or the underscore character. In which case you can test for the special value by using .L
These special missing values will appear in table views or printed output as upper case letters even when assigned with lower case.
How to use:
If variable = .L then do <whatever you were going to do>.
An example creating a special missing and printing:
data junk; x=.a; run; proc print data=junk; run;
One reason for special missing values is that you can test for the condition(s) and use differently than a basic missing. Or create a custom format to display different text such as "Skipped" or "Not Answered" or "Refused" so you have more information about why at least some of the values are missing.
If a variable essentially has two values it is often quite advantageous to code the values as 1/ 0 where the 1 goes to the level most often of interest.
Reason is many tasks become much simpler. If the values were 1/0 with 1=Employed and 0=unemployed then
employment= sum(Parent1, Parent2);
would mean: employment=2 both employed, 1= only one employed, 0=no adult employed. You would get a missing value only if both of the variables were missing. Reason to use sum function is Parent1+Partent2 would return a missing value if either of the variables were missing.
Unless you have some user defined format attached to the variable then numbers that PRINT as the single letter uppercase L contain the special missing value of .L .
So you can test if the value is .L exactly using one of these ways:
parent1 = .L
parent1 = .l
parent1 in (.L)
parent1 in (.l)
Or you can test if it has any of the 28 different missing values that SAS supports by using the MISSING function.
missing(parent1)
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.