when you create a variable and have not assigned value to it , does it equals to "null" or zero?
Maxim 4: Try It.
data check;
length
x1 8 /* numeric */
x2 $8 /* character */
;
run;
Read the log and view the resulting dataset.
so if it is a number it is "." which means missing
if strange, it is empty so it is null?
Maxim 6: Google Is Your Friend.
Do a search for "sas missing value" and follow the first result: https://www.pauldickman.com/sastips/missing/
Suggest that when working with SAS and missing values that you do not think of "NULL" or "empty". Because you can have more than one missing value for numeric variables. Besides the default displayed dot (and that is YOUR option to change as needed) there are special missing values .A to .Z (dot and one letter) and the underscore: ._ So there is something stored to differentiate these values, they all return missing when tested but can display differently.
One use for the special missing values is to show a known reason for the value to be missing in variable.
Example. The first data step creates set with one numeric value and some special missing. Then uses Proc Means to provide some requested statistics, note the number of NMISS, number of missing values. Then a custom format is created to provide a meaning for the special missing and proc print to demonstrate the use of that format with the example data set.
data example; input x; datalines; 1 .A .B .C .D ; proc means data=example n nmiss sum; var x; run; Proc format; value mycustommiss .A = 'Not answered' .B = 'Broken instrument' .C = 'Cancelled request' .D = "Don't Know" ; proc print data=example; var x; format x mycustommiss.; run;
And to head off questions about character variables and special missing, no. Reading values like .A into a character variable results in the character value of .A.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: