BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Dylannn3
Calcite | Level 5
Question prompt:

examine the effect of alcohol use on CKD, adjusting for age as a potential confounder (included as a dichotomous variable representing 50+ compared to 20-49 years).

Here is my code:
libname cesd4 '/home/u61727912/bios5204';
data logis;
set cesd4.logis;
if age >= 50 then agegrp2 = 1;
else if age >= 20 and age <= 49 then agegrp2 = 0;
run;

proc logistic data=logis descending;
model CKD=EtOH agegrp2 / clodds=wald;
run;

Error from SAS:
There are no valid observations

I’m not sure why it is saying no observations because that shouldn’t be true?
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@Dylannn3 wrote:

Screenshot 2023-05-07 at 10.10.30 AM.png

Ran the proc freq and this is what it is showing me 

 


Which tells use that your Agegroup variable has already been collapsed to represent some range of ages and does not have any values greater than 1. You need to go to the source of the data to find out what 0 and 1 represent.Likely the 1 means in some specific range of ages and 0 all the other ages. But without documentation somewhere the range is unknown.

 

Or find an actual age variable somewhere (might have really different name) or possibly a variable containing date of birth and calculate an age at a given point in that that you can used to make your Agegrp2.

 

View solution in original post

10 REPLIES 10
Patrick
Opal | Level 21

Normally such SAS messages are correct. To verify what you've got you could run:

proc freq data=logis;
  table agegrp2;
run;
ballardw
Super User

Or show the LOG from running the data step. Copy the data step code and all notes, messages, warnings or errors. Then on the forum open a text box and paste all that text.

Dylannn3
Calcite | Level 5
Here is the LOG: 
 
 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 libname cesd4 '/home/u61727912/bios5204';
NOTE: Libref CESD4 was successfully assigned as follows:
Engine: V9
Physical Name: /home/u61727912/bios5204
70 data logis;
71 set cesd4.logis;
NOTE: Data file CESD4.LOGIS.DATA is in a format that is native to another host, or the file encoding does not match the session
encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce
performance.
72 if age >= 50 then agegrp2 = 1;
73 else if age >= 20 and age <= 49 then agegrp2 = 0;
74 run;
 
NOTE: Variable age is uninitialized.
NOTE: There were 3000 observations read from the data set CESD4.LOGIS.
NOTE: The data set WORK.LOGIS has 3000 observations and 6 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 1214.65k
OS Memory 23972.00k
Timestamp 05/02/2023 02:27:30 PM
Step Count 67 Switch Count 2
Page Faults 0
Page Reclaims 163
Page Swaps 0
Voluntary Context Switches 10
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 520
 
 
75
76 proc logistic data=logis descending;
77 model CKD=EtOH agegrp2 / clodds=wald;
78 run;
 
ERROR: There are no valid observations.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 3000 observations read from the data set WORK.LOGIS.
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 744.34k
OS Memory 23972.00k
Timestamp 05/02/2023 02:27:30 PM
Step Count 68 Switch Count 0
Page Faults 0
Page Reclaims 52
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
 
79
80 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
90
StatDave
SAS Super FREQ
The log says that your AGE variable is uninitialized. As a result, all of the AGEGRP2 values will be missing so that none of the observations are usable in LOGISTIC. Perhaps your age variable has a different name?
Dylannn3
Calcite | Level 5

Hi so you were correct about the "age" variable being missed labeled. I updated it to "agegrp" which is the correct variable name but I still can't get the code to run. 

 

I also ran this proc:

 

proc freq data=logis;
table agegrp2;
run; 

To see the frequencies and it came up blank. 

 

After updating the variable here is the new log (with error still):

 

 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 libname cesd4 '/home/u61727912/bios5204';
NOTE: Libref CESD4 was successfully assigned as follows:
Engine: V9
Physical Name: /home/u61727912/bios5204
70 data logis;
71 set cesd4.logis;
NOTE: Data file CESD4.LOGIS.DATA is in a format that is native to another host, or the file encoding does not match the session
encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce
performance.
72 if agegrp >= 50 then agegrp2 = 1;
73 else if agegrp >= 20 and agegrp <= 49 then agegrp2 = 0;
74 run;
 
NOTE: There were 3000 observations read from the data set CESD4.LOGIS.
NOTE: The data set WORK.LOGIS has 3000 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 1140.84k
OS Memory 23204.00k
Timestamp 05/06/2023 09:59:45 AM
Step Count 75 Switch Count 2
Page Faults 0
Page Reclaims 186
Page Swaps 0
Voluntary Context Switches 18
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
 
 
75
76 proc logistic data=logis descending;
77 model CKD=EtOH agegrp2 / clodds=wald;
78 run;
 
ERROR: There are no valid observations.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 3000 observations read from the data set WORK.LOGIS.
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 0.00 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 603.43k
OS Memory 23204.00k
Timestamp 05/06/2023 09:59:45 AM
Step Count 76 Switch Count 0
Page Faults 0
Page Reclaims 52
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
 
79
80 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
90

 

 

StatDave
SAS Super FREQ

Run this to see the patterns of missing values that exist in the data and post the results:

   proc mi data=logis nimpute=0;
      var CKD EtOH agegrp2;
      ods select MissPattern;
      run;

 

ballardw
Super User

Probably another variation of not knowing your data.

 

Your code in the log assumes AGEGRP has values of 50 or greater and then between 20 and 49.

72 if agegrp >= 50 then agegrp2 = 1;
73 else if agegrp >= 20 and agegrp <= 49 then agegrp2 = 0;

I bet that someone already reduced something of an age, or used a response to a question so that your AGEGRP variable is already categories of some sort and very likely to have many fewer values.

Run this and show us the result:

Proc freq data=logis;
   tables agegrp * agegrp2 / list missing;
run;

 

Dylannn3
Calcite | Level 5

Screenshot 2023-05-07 at 10.10.30 AM.png

Ran the proc freq and this is what it is showing me 

 

ballardw
Super User

@Dylannn3 wrote:

Screenshot 2023-05-07 at 10.10.30 AM.png

Ran the proc freq and this is what it is showing me 

 


Which tells use that your Agegroup variable has already been collapsed to represent some range of ages and does not have any values greater than 1. You need to go to the source of the data to find out what 0 and 1 represent.Likely the 1 means in some specific range of ages and 0 all the other ages. But without documentation somewhere the range is unknown.

 

Or find an actual age variable somewhere (might have really different name) or possibly a variable containing date of birth and calculate an age at a given point in that that you can used to make your Agegrp2.

 

Dylannn3
Calcite | Level 5

Hi thank you!!! you were correct the age group variable was collapsed. I was able to finish the rest of my analysis. Thank you once again for everyones help in this thread!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 10 replies
  • 1644 views
  • 1 like
  • 4 in conversation