BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
CraigSmith
Obsidian | Level 7

Hi all,

 

Have attached screenshots and have copied code / outputs below - struggling to include basic analysis on smoking variable. Any idea how to fix this? 

 

Many thanks in advance,

 

Craig

 

Data dictionary is as follows;

smok

1093Created141numberSmoking never/former/current0Never1Former2Current99Missing

 

Had formatted as follows:

PROC FORMAT;
VALUE SMOK
0 = 'Never smoker'
1 = 'Former smoker'
2 = 'Current smoker'
99 = 'missing'
;

 

And was using the following for a logistic regression 

 

proc logistic data= ARCAGE;
FORMAT SMOK SMOK. DRINK DRINK. SEX SEX.;
CLASS SMOK ( REF = '0: Never smoker')
DRINK (REF = '0: Never')
SEX ( REF = '2: Female' )
BMIC ( REF = '2' );

model CASE = AGE10 SEX SMOK SMOKP PROLEV DRINK ALCOIC BMIC /rocci RL SELECTION = F;
run;

 

Screenshot (86).pngScreenshot (87).pngScreenshot (88).pngScreenshot (89).png

 

1007 PROC FORMAT;
1008 VALUE SMOK
1009 0 = 'Never smoker'
1010 1 = 'Former smoker'
1011 2 = 'Current smoker'
1012 99 = 'missing'
1013 ;
NOTE: Format SMOK is already on the library WORK.FORMATS.
NOTE: Format SMOK has been output.

NOTE: PROCEDURE FORMAT used (Total process time):
real time 11.71 seconds
cpu time 1.07 seconds


1014 proc logistic data= ARCAGE;
1015 FORMAT SMOK SMOK. DRINK DRINK. SEX SEX.;
1016 CLASS SMOK ( REF = '0: Never smoker')
1017 DRINK (REF = '0: Never')
1018 SEX ( REF = '2: Female' )
1019 BMIC ( REF = '2' );
1020
1021 model CASE = AGE10 SEX SMOK SMOKP PROLEV DRINK ALCOIC BMIC /rocci RL SELECTION = F;
1022 run;

ERROR: Invalid reference value for SMOK.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 3969 observations read from the data set WORK.ARCAGE.
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

The formatted value is 'Never smoker' so you want

 

CLASS SMOK ( REF = 'Never smoker')

 

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

The formatted value is 'Never smoker' so you want

 

CLASS SMOK ( REF = 'Never smoker')

 

--
Paige Miller
CraigSmith
Obsidian | Level 7

Thanks so much Paige - got it working!

 

Many thanks,

 

Craig 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1312 views
  • 2 likes
  • 2 in conversation