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

Properties state file name is: Location:  /home/u63563754/sasuser.v94/week8.sas7bdat

 

Please help with assignment. Please and thank you. 

 

I sent libname, code, and errors. 

 

Code: 

libname '/home/u63563754/sasuser.v94/week8.sas7bdat';
data sasuser.week8;
set sasuser.week8;
KEEP SEXVAR GENHLTH PHYSHLTH MENTHLTH MEDCOST1 ASTHMA3 DIABAGE3 EDUCA __RFSMOK3 LCSNUMCG FLUSHOT7 __RFBING5 __IMPRACE __AGE80 __BMI5;
*/HERE ARE MY RECODES FOR MISSING VALUES/*;
if genhlth = '7' or genhlth = '9' then genhlth = ' ';
if physhlth = '77' or physhlth = '99' then physhlth = ' ';
if menthlth = '77' or menthlth = '99' then menthlth = ' ';
if medcost1 = '7' or medcost1 '9' then medcost1 = ' ';
if asthma3 = '7' or asthma3 = '9' then asthma3 = ' ';
if diabage3 = '98' or diabage3 = '99' then diabage3 = ' ';
if educa = '9' then educa = ' ';
if lcsnumcg = '777' or lcsnumcg = '999' then lcsnumcg = ' ';
if flushot = '7' or flushot = '9' then flushot = ' ';
if __rfbing '9' then __rfbing = ' ';
if __rfsmok '9' then __rfsmok = ' ';
RUN;

proc contents data=sasuser.week8;

proc format;
VALUE $sexvar '1' = 'MALE' '2' = ' FEMALE';
VALUE $genhlth '1' = 'EXCELLENT' '2' = 'VERY GOOD' '3' = 'GOOD' '4' = 'FAIR' '5' = 'POOR' '7' = 'DONT KNOW/NOT SURE' '9' = 'REFUSED' 'BLANK' = 'NOT ASKED OR MISSING';
VALUE $physhlth '1-30' = 'NUMBER OF DAYS' '88' = 'NONE' '77' = 'DONT KNOW/NOT SURE' '99' = 'REFUSED' 'BLANK' = 'NOT ASKED OR MISSING';
VALUE $menthlth '1-30' = 'Number OF DAYS' '88' = 'NONE' '77' = 'DONT KNOW/NOT SURE' '99' = 'REFUSED' 'BLANK' = 'NOT ASKED OR MISSING';
VALUE $medcost '1' = 'YES' '2' = 'NO' '7' = 'DONT KNOW/NOT SURE' '9' = 'REFUSED' 'BLANK' = 'NOT ASKED OR MISSING';
VALUE $asthma '1' = 'YES' '2' = 'NO' '7' = 'DONT KNOW/NOT SURE' '9' = 'REFUSED' 'BLANK' = 'NOT ASKED OR MISSING';
VALUE $diabage '1-97' = 'AGE IN YEARS' '98' = 'DONT KNOW/NOT SURE' '99' = 'REFUSED' 'BLANK' = 'NOT ASKED OR MISSING';
VALUE $educa '1' = 'NEVER ATTENDED SCHOOL OR ONLY KINDERGARTEN' '2' = 'GRADES 1 THROUGH 8 (ELEMENTARY)' '3' 'GRADES 9 THROUGH 11 (SOME HIGH SCHOOL)' '4' = 'GRADE 12 or GED (HIGH SCHOOL GRADUATE)' '5' = 'COLLEGE 1 YEAR to 3 YEARS (SOME COLLEGE OR TECHNICAL SCHOOL)' '6' = 'COLLEGE 4 YEARS OR MORE (COLLEGE GRADUATE)' '9' = 'REFUSED' 'BLANK' = 'NOT ASKED OR MISSING';
VALUE $__rfsmoke '1' = 'NO' '2' = 'YES' '9' = 'DONT KNOW/REFUSED/MISSING';
VALUE $lcsnumcg '1-300' = 'NUMBER OF CIGARETTES' '777' = 'DONT KNOW/NOT SURE' '999' = 'REFUSED' 'BLANK' = 'NOT ASKED OR MISSING';
VALUE $flushot '1' = 'YES' '2' = 'NO' '7' = 'DONT KNOW/NOT SURE' '9' = 'REFUSED' 'BLANK';
VALUE $__rfbing '1' = 'NO' '2' = 'YES' '9' = 'DONT KNOW/REFUSED/MISSING';
VALUE $__imprace '1' = 'WHITE, NON-HISPANIC' '2' = 'BLACK, NON-HISPANIC' '3' = 'ASIAN, NON-HISPANIC' '4' = 'AMERICAN INDIAN/ALASKAN NATIVE, NON-HISPANIC' '5' = 'HISPANIC' '6' = 'OTHER RACE, NON-HISPANIC';
VALUE $__age '18-24' = 'IMPUTED AGE 18 to 24' '25-29' = 'IMPUTED AGE 25 to 29' '30-34' = 'IMPUTED AGE 30 to 34' '40-44' = 'IMPUTED AGE 40 to 44' '45-49' = 'IMPUTED AGE 45 to 49' '50-54' = 'IMPUTED AGE 50 to 54' '55-59' = 'IMPUTED AGE 55 to 59' '60-64' = 'IMPUTED AGE 60 to 64' '65-69' = 'IMPUTED AGE 65 to 69' '70-74' = 'IMPUTED AGE 70 to 74' '75-79' = 'IMPUTED AGE 75 to 79' '80-99' = 'IMPUTED AGE 80 OR OLDER';
VALUE $__bmi '1-9999' = '1 or greater' 'BLANK' = 'DONT KNOW/REFUSED/MISSING';
run;

proc anova DATA=sasuser.week8;
class SEXVAR;
model SEXVAR = SEXVAR;
means SEXVAR / SCHEFFE;
title 'Sex of Respondent';
run;

proc anova DATA=sasuser.week8;
class GENHLTH;
model GENHLTH = GENHLTH;
means GENHLTH / SCHEFFE;
title 'How is Your Health';
run;

proc anova DATA=sasuser.week8;
class PHYSHLTH;
model PHYSHLTH = PHYSHLTH;
means PHYSHLTH / SCHEFFE;
title 'Physical Health Not Good?';
run;

proc anova DATA=sasuser.week8;
class MENTHLTH;
model MENTHLTH = MENTHLTH;
means MENTHLTH / SCHEFFE;
title 'Mental Health Not Good?';
run;
proc anova DATA=sasuser.week8;
class MEDCOST1;
model MEDCOST1 = MEDCOST1;
means MEDCOST1 / SCHEFFE;
title 'Could Not Afford Doctor?';
run;
proc anova DATA=sasuser.week8;
class ASTHMA3;
model ASTHMA3 = ASTHMA3;
means ASTHMA3 / SCHEFFE;
title 'Ever Been Told You Have Asthma?';
run;
proc anova DATA=sasuser.week8;
class DIABAGE3;
model DIABAGE3 = DIABAGE3;
means DIABAGE3 / SCHEFFE;
title 'How Old Were You When You Had Diabetes?';
run;

proc anova DATA=sasuser.week8;
class EDUCA;
model EDUCA = EDUCA;
means EDUCA / SCHEFFE;
title 'What Is The Highest Grade You Completed?';
run;
proc anova DATA=gunterj.week8a;
class __RFSMOK3;
model __RFSMOK3 = __RFSMOK3;
means __RFSMOK3 / SCHEFFE;
title 'Adults Who Are Current Smokers';
run;
proc anova DATA=sasuser.week8;
class LCSNUMCG;
model LCSNUMCG = LCSNUMCG;
means LCSNUMCG / SCHEFFE;
title 'How Many Cigarettes Do You Smoke?';
run;

proc anova DATA=sasuser.week8;
class FLUSHOT;
model FLUSHOT = FLUSHOT;
means FLUSHOT / SCHEFFE;
title 'Flu Vaccine in Nose or Arm?';
run;
proc anova DATA=sasuser.week8;
class __RFBING5;
model __RFBING5 = __RFBING5;
means __RFBING5 / SCHEFFE;
title 'Binge Drinkers';
run;

proc anova DATA=sasuser.week8;
class __IMPRACE;
model __IMPRACE = __IMPRACE;
means __IMPRACE / SCHEFFE;
title 'Imputed Race/Ethnicity Value';
run;
proc anova DATA=sasuser.week8;
class __AGE80;
model __AGE80 = __AGE80;
means __AGE80 / SCHEFFE;
title 'Imputed Age Value Collapsed Above 80';
run;
proc anova DATA=sasuser.week8;
class __BMI5;
model __BMI5 = BMI5;
means __BMI5 / SCHEFFE;
title 'Body Mass Index';
run;
quit;

ERRORS:

Lilly1FAMU_0-1698022540714.png

Lilly1FAMU_1-1698022704545.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Best practice on this forum is to copy the log text including submitted code and any error messages, open a text box using the </> icon that appears above the message window and paste the text.

The text box does two things, first it prevents the forum software from reformatting pasted text which the main message window does. That means that diagnostic characters SAS often provides in the log are not moved as the positions are helpful. It also sets the log apart from questions and discussion visually. Providing copied text means that when it is a good way to demonstrate the correction or an option we can copy and paste text which is practically impossible from pictures. Plus the copy and paste of text should be easier than creating picture and then linking that in the forum.

A brief example:

65   Proc freq data=sashelp.class
66     tables sex* age /list;
       ------
       22
       76
ERROR 22-322: Syntax error, expecting one of the following: ;, (,
              COMPRESS, DATA, FC, FORMCHAR, NLEVELS, NOPRINT, ORDER,
              PAGE.
ERROR 76-322: Syntax error, statement will be ignored.
67     format sex $mysexformat.;
68   run;

Note that the underscore characters are showing Tables is not correct. In this case because the semicolon is missing on the Proc Freq statement.

 

It might help to describe exactly what the purpose of running all of those Proc Anova may be. Models of the form:

Model thisvar = thisvar;

are in general pretty uninteresting as far as things go.

 

And if that data is from the Behavior Risk Factor Surveillance System this is one of the oddest "analysis approaches" I have seen in nearly 25 years of working with BRFSS data.

 

View solution in original post

2 REPLIES 2
Patrick
Opal | Level 21

Patrick_0-1698023634189.png

https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsglobal/n1nk65k2vsfmxfn1wu17fntzszbp... 

 

It's normally best to only investigate and resolve the first error. Any later error could be cause by the first error so it's not worth spending time on it.

 

In your case the SAS-library needs to be the FOLDER that contains the SAS files AND it needs a libref.

libname mydata '/home/u63563754/sasuser.v94' access=readonly;
data want;
set mydata.<table>;
run;

There are a few pre-assigned libraries that SAS assigns during startup. SASUSER is one of these libraries which means you likely won't even need a libname but can just run your first data step.

 

To list which tables and columns are available under a libref you can run code as per below example for libref SASUSER:

proc contents data=sasuser._all_;
run;

And last but not least: Don't overwrite a table with itself because it makes it much harder to recover once something goes wrong. In your case create the new table in WORK.

data WORK.week8;
   set sasuser.week8;
   .....

WORK is also one of these pre-assigned libraries. Additionally SAS will automatically clean-up anything stored under WORK when it terminates the SAS session so you don't fill-up your disk with tables only needed during a session.

ballardw
Super User

Best practice on this forum is to copy the log text including submitted code and any error messages, open a text box using the </> icon that appears above the message window and paste the text.

The text box does two things, first it prevents the forum software from reformatting pasted text which the main message window does. That means that diagnostic characters SAS often provides in the log are not moved as the positions are helpful. It also sets the log apart from questions and discussion visually. Providing copied text means that when it is a good way to demonstrate the correction or an option we can copy and paste text which is practically impossible from pictures. Plus the copy and paste of text should be easier than creating picture and then linking that in the forum.

A brief example:

65   Proc freq data=sashelp.class
66     tables sex* age /list;
       ------
       22
       76
ERROR 22-322: Syntax error, expecting one of the following: ;, (,
              COMPRESS, DATA, FC, FORMCHAR, NLEVELS, NOPRINT, ORDER,
              PAGE.
ERROR 76-322: Syntax error, statement will be ignored.
67     format sex $mysexformat.;
68   run;

Note that the underscore characters are showing Tables is not correct. In this case because the semicolon is missing on the Proc Freq statement.

 

It might help to describe exactly what the purpose of running all of those Proc Anova may be. Models of the form:

Model thisvar = thisvar;

are in general pretty uninteresting as far as things go.

 

And if that data is from the Behavior Risk Factor Surveillance System this is one of the oddest "analysis approaches" I have seen in nearly 25 years of working with BRFSS data.

 

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!

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
  • 474 views
  • 0 likes
  • 3 in conversation