Write and run SAS programs in your web browser

How to correct error messages in SAS Studio?

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

How to correct error messages in SAS Studio?

I am using SAS Ondemand Academics, SAS Studio. For an assignment, codes were given and I have copied and pasted as well as iputted the codes manually. Error messgaes are available and I do not know how to correct the errors to yield the results. The attachment of the error message is for the code below. 

 

DATA smo_cardio ;            INPUT exposed $ disease $ patients ; DATALINES ;               exposed disease 50               exposed none    50               not_exp disease 25               not_exp none    75 ; PROC FREQ DATA = smo_cardio ;     TABLES exposed*disease / RELRISK RISKDIFF ;     WEIGHT patients ; RUN ;

 

This is an additional code.

PROC CONTENTS DATA = sashelp.heart ; PROC FREQ DATA = sashelp.heart ; TABLES ageatdeath*deathcause / OUT = test1 ; PROC PRINT DATA = test1 ; PROC GPLOT DATA = test1 ; PLOT count*ageatdeath = deathcause ; WHERE deathcause in ("Cancer","Cerebral Vascular Disease", "Coronary Heart Disease") ; SYMBOL1 INTERPOL = JOIN ; DATA test2 ;             SET sashelp.heart ;             ageatdeath5 = ROUND(ageatdeath,5) ; PROC FREQ DATA = test2 ;               TABLES ageatdeath5*deathcause / OUT= test3 ; PROC GPLOT DATA = test3 ;               PLOT count*ageatdeath5 =deathcause ;               WHERE deathcause IN ("Cancer","Cerebral Vascular Disease","Coronary Heart Disease") ; SYMBOL1 INTERPOL = JOIN ; RUN ;

 


Accepted Solutions
Solution
‎09-27-2016 11:01 PM
Frequent Contributor
Posts: 123

Re: How to correct error messages in SAS Studio?

You're also missing a bunch of run statements. Try copy and pasting this instead:

 

DATA smo_cardio;
INPUT exposed $ disease $ patients;
DATALINES;
exposed disease 50
exposed none 50
not_exp disease 25
not_exp none 75
;
RUN;

PROC FREQ DATA =  smo_cardio;
TABLES exposed*disease / RELRISK RISKDIFF;
WEIGHT patients;
RUN;

PROC CONTENTS DATA = sashelp.heart;
RUN;

PROC FREQ DATA = sashelp.heart;
TABLES ageatdeath*deathcause / OUT = test1;
RUN;

PROC PRINT DATA = test1;
RUN;

PROC GPLOT DATA = test1;
PLOT count*ageatdeath = deathcause;
WHERE deathcause in("Cancer","Cerebral Vascular Disease","Coronary Heart Disease");
SYMBOL1 INTERPOL = JOIN;
RUN;

DATA test2;
SET sashelp.heart;
ageatdeath5 = ROUND(ageatdeath,5);
RUN;

PROC FREQ DATA = test2;
TABLES ageatdeath*deathcause / OUT = test3;
RUN;

PROC GPLOT DATA = test3;
PLOT count*ageatdeath5 = deathcause;
WHERE deathcause in("Cancer","Cerebral Vascular Disease","Coronary Heart Disease");
SYMBOL1 INTERPOL = JOIN;
RUN;

View solution in original post


All Replies
Grand Advisor
Posts: 10,241

Re: How to correct error messages in SAS Studio?

Please post attachments as TEXT files not Microsoft office documents or spreadsheets due to issues around security. Many users here will not open them, or their security settings will not allow them to open these files.

 

I wonder if you are using code that was copied from somewhere and pasted into the editor. Some sources end up embedding characters that are not visible but are detected by the code parser. If you did copy and paste, then delete the text and type it from scratch.

 

Also with DATALINES it is a good practice to left justify the data.

Solution
‎09-27-2016 11:01 PM
Frequent Contributor
Posts: 123

Re: How to correct error messages in SAS Studio?

You're also missing a bunch of run statements. Try copy and pasting this instead:

 

DATA smo_cardio;
INPUT exposed $ disease $ patients;
DATALINES;
exposed disease 50
exposed none 50
not_exp disease 25
not_exp none 75
;
RUN;

PROC FREQ DATA =  smo_cardio;
TABLES exposed*disease / RELRISK RISKDIFF;
WEIGHT patients;
RUN;

PROC CONTENTS DATA = sashelp.heart;
RUN;

PROC FREQ DATA = sashelp.heart;
TABLES ageatdeath*deathcause / OUT = test1;
RUN;

PROC PRINT DATA = test1;
RUN;

PROC GPLOT DATA = test1;
PLOT count*ageatdeath = deathcause;
WHERE deathcause in("Cancer","Cerebral Vascular Disease","Coronary Heart Disease");
SYMBOL1 INTERPOL = JOIN;
RUN;

DATA test2;
SET sashelp.heart;
ageatdeath5 = ROUND(ageatdeath,5);
RUN;

PROC FREQ DATA = test2;
TABLES ageatdeath*deathcause / OUT = test3;
RUN;

PROC GPLOT DATA = test3;
PLOT count*ageatdeath5 = deathcause;
WHERE deathcause in("Cancer","Cerebral Vascular Disease","Coronary Heart Disease");
SYMBOL1 INTERPOL = JOIN;
RUN;
New Contributor
Posts: 2

Re: How to correct error messages in SAS Studio?

Thank you so very much!
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 325 views
  • 0 likes
  • 3 in conversation