Hope someone can help me figure this out....I am getting a warning in code someone else wrote; so i am not exactly sure what they were trying to see if on condition_2 the value is missing then set the return to state null. Hope this makes sense; still new at SAS. I get returned information but if the value is missing it leaves it blank.
How would I write this to get NULL instead of blank fields?
Data work.conditions01;
set work.conditions;
if condition_2='' then condition_2='[null]';
else;
run;
100 Data work.conditions01;
101 set work.conditions;
102 if condition_2='' then condition_2='[null]';
103 else;
104 run;
NOTE: There were 828 observations read from the data set WORK.CONDITIONS.
NOTE: The data set WORK.CONDITIONS01 has 828 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
Excel output:
blank condition_2 should say null I believe???
Thanks in advance for you r time,
Becky
the table shows null but the log gives me a warning and it does not print
CODE:
**Pulls "fa" post rule conditions**;
Data work.conditions;
set almis_.fa_postcond;
where substr(tran_post_code,1,1) in &type and action_code in &action;
run;
Data work.conditions01;
set work.conditions;
if condition_2='' then condition_2='[null]';
else;
run;
Data work.conditions01;
set work.conditions01;
logic=catx(' ', condition_1, operator_1, condition_2, operator_2);
run;
Proc sort data=work.conditions01;
by action_code tran_post_code cond_order condition_1;
run;
*************************************************************************************************************
LOG FILE:
\
94 **Pulls "fa" post rule conditions**;
95
6 The SAS System Thursday, May 27, 2021 11:01:36 AM
96 Data work.conditions;
97 set almis_.fa_postcond;
98 where substr(tran_post_code,1,1) in &type and action_code in &action;
99 run;
NOTE: There were 828 observations read from the data set ALMIS_.FA_POSTCOND.
WHERE SUBSTR(tran_post_code, 1, 1) in ('E', 'F', 'G', 'H') and action_code in (14, 16, 19, 20, 21, 23, 26, 28, 29, 30, 32,
33, 34, 36, 39, 40, 106, 124, 153, 154);
NOTE: The data set WORK.CONDITIONS has 828 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
100 Data work.conditions01;
101 set work.conditions;
102 if condition_2='' then condition_2='[null]';
103 else;
104 run;
NOTE: There were 828 observations read from the data set WORK.CONDITIONS.
NOTE: The data set WORK.CONDITIONS01 has 828 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
105 Data work.conditions01;
106 set work.conditions01;
107 logic=catx(' ', condition_1, operator_1, condition_2, operator_2);
108 run;
NOTE: There were 828 observations read from the data set WORK.CONDITIONS01.
NOTE: The data set WORK.CONDITIONS01 has 828 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
109 Proc sort data=work.conditions01;
110 by action_code tran_post_code cond_order condition_1;
111 run;
NOTE: There were 828 observations read from the data set WORK.CONDITIONS01.
NOTE: The data set WORK.CONDITIONS01 has 828 observations and 8 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
thanks for looking at this for me.
the log shows no errors
proc print statement:
ods excel options(sheet_name="conditions");
Proc print data=work.conditions style(header)=[backgroundcolor=lightblue fontfamily=times fontweight=bold] noobs;
run;
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.