BookmarkSubscribeRSS Feed
mariamon0
Fluorite | Level 6

 

I believe my merging of the datasets is fine but I am trying to analyze the data and it keeps coming back with this error:

Variable C06_day1 is uninitialized.
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
8969 at 2753:20 8969 at 2754:21
NOTE: There were 51080 observations read from the data set WORK.STEPDATA4.
NOTE: The data set WORK.STEPDATA5 has 0 observations and 17 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

 

I am trying to create new variables C6_day1 and C6day14 which are 1 day and 14 days after the C6_date. Every time I run this it says there is 0 observations. Even though it successfully merged with my other datasets.

 

data stepdata5; set stepdata4;
format C6_date mmddyy10. C6_day1 mmddyy10. C6_day14 mmddyy10. ;
C6_day1=C6_date+1;
C6_day14=C6_date+14;
if C06_day1 le 0 then delete;
run;

8 REPLIES 8
PaigeMiller
Diamond | Level 26

Your code assigns a value to a variable named C6_day1. However there does not appear to be a variable named C06_day1. These are two different variables.

--
Paige Miller
PeterClemmensen
Tourmaline | Level 20

Shouldn't C06_day1 be C6_day1? 

mariamon0
Fluorite | Level 6

yes but it is still saying 0 observations when I run it

PaigeMiller
Diamond | Level 26

@mariamon0 wrote:

yes but it is still saying 0 observations when I run it


When you run what? What code is producing this result with 0 observations?

 

In your code from your original message, if c06_day1 is uninitialized, then it will result in 0 observations. You have to use the proper name of the variable.

 

If that's not it, then show us what you are seeing, show us a part of your data set stepdata5 so we can see it. Don't make us guess.

--
Paige Miller
mariamon0
Fluorite | Level 6

 

I fixed it but its still coming up as an error.

 

Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
10028 at 3824:20 10028 at 3825:21
NOTE: There were 53186 observations read from the data set WORK.STEPDATA3.
NOTE: The data set WORK.STEPDATA4 has 43158 observations and 14 variables.
NOTE: DATA statement used (Total process time)
3830 proc freq data=stepdata4;
3831 where stepvalid=1 and C6_day1 le 14;
3832 tables study_id/ noprint out=counts (rename=(count=per_study_id) ) ;
3833 run;

NOTE: No observations were selected from data set WORK.STEPDATA4.
NOTE: There were 0 observations read from the data set WORK.STEPDATA4.
WHERE (stepvalid=1) and (C6_day1<=14);
NOTE: The data set WORK.COUNTS has 0 observations and 3 variables.
NOTE: PROCEDURE FREQ used (Total process time):

 

data stepdata4; set stepdata3;
format C6_date mmddyy10. C6_day1 mmddyy10. C6_day14 mmddyy10. ;
C6_day1=C6_date+1;
C6_day14=C6_date+14;
if C6_day1 le 0 then delete;
run;


proc freq data=stepdata4;
where stepvalid=1 and C6_day1 le 14;
tables study_id/ noprint out=counts (rename=(count=per_study_id) ) ;
run;

proc freq data=counts;
tables per_study_id;
run;

Shmuel
Garnet | Level 18

1) Your post shows only part of the log/

    Pay attention to the message:

   

Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line)Smiley SadColumn).
10028 at 3824:20 10028 at 3825:21

I can't see what code is on log line 3825 and what variables are involved.

 

2) When you use WHERE clause, sas counts only those observation that meet the conditions.

    It counts 0 obs because no obs meet the condition:

where stepvalid=1 and C6_day1 le 14;

   in case c6_day1 is missing then it meets the condition c6_day le 14, which means you have to check are

   there obs with stepvalid=1, or maybe there is a typo in stepvalid variable name.

Kurt_Bremser
Super User

Your log starts at line 3830, which means there are 3829 lines of code before that could be the reason for your problems. At least(!) show us the whole log (including all code lines!) of the step that includes lines 3824 & 3825.

 

If C6_date is a SAS date variable, then adding 1 to it and comparing with 14 will only work for dates before 1960-01-13. Keep in mind that SAS dates are counts of days from 1960-01-01.

PeterClemmensen
Tourmaline | Level 20

Well, I can't see your data from here 🙂 Post some example of what your data looks like

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 945 views
  • 0 likes
  • 5 in conversation