Help using Base SAS procedures

Proc Boxplot

Reply
N/A
Posts: 0

Proc Boxplot

hello,

I import an excel datafile and stored it permnanently in same location



PROC IMPORT OUT=WORK.SAS1/*Store the data in the WORK file once imported*/
DATAFILE= "C:\CWA\SAS.xls"/*search the file SAS.xls in "C:\CWA"*/
DBMS=EXCEL REPLACE;
SHEET="Review"/*Import the sheet Review from the file SAS.xls*/ ;
GETNAMES=YES;
MIXED=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;

proc print data=SAS1;
run;

libname dis "C:\SAS\"/*Put the SAS.xls file into the directory "C:\SAS"*/ ;

proc import datafile="C:\SAS\SAS.xls" out=dis.mySAS replace/*convert the file SAS.xls into the SAS datafile "mySAS"*/;
run;


PROC Contents data=dis.mySAS;
RUN;

Proc print data=dis.mySAS;
RUN;

libname dis "C:\SAS\";
proc boxplot data=dis.mySAS;
plot Score*(GHz Price Processor memory Disk Video Battery)/
cframe = vligb
cboxes = dagr
cboxfill = ywh
vaxis = axis1;
run;

I get error in LOG (just after the plot statement in the last code) that "expecting a variable name ; variable name not found ".

Any suggestions to correct the lof error.

Kindest Regards,
Mark
SAS Super FREQ
Posts: 8,864

Re: Proc Boxplot

Posted in reply to deleted_user
Hi:
It would be useful to see your WHOLE log to see when/where things might start to go wrong.

One quick thing that might help would be for you to tell us what the PROC CONTENTS and PROC PRINT reveal about your SAS dataset DIS.MYSAS. Does the PROC CONTENTS show these variable names: Score GHz Price Processor memory Disk Video Battery as existing in the DIS.MYSAS dataset?? When you look at the PROC PRINT of DIS.MYSAS dataset, do you see the values that you expect to see?

If you don't see what you expect in the PROC PRINT and the PROC CONTENTS outputs, then that means the problem is farther up in the PROC IMPORT step. I'm not sure I understand the relationship of the first PROC IMPORT to the second PROC IMPORT step...as it looks like the data from the -second- PROC IMPORT is what you're plotting with PROC BOXPLOT.

However, if the PROC PRINT from the first PROC IMPORT shows the variables you expect to use and the second PROC IMPORT is being done on a copy of the first spreadsheet, that is one PROC IMPORT too many. You do not have to copy your Excel file into "C:\SAS" in order to import it into a SAS dataset. I do notice that the first PROC IMPORT uses more options than the second PROC IMPORT. If these are the same workbook/worksheet, then you really do need to use the same options every time you do the import. But, you know more about the data than I do -- so perhaps there's something different between the data in the first PROC IMPORT step and the second PROC IMPORT step that you didn't tell us about.

Alternately, you could try just using WORK.SAS1 in your PROC BOXPLOT and see whether that imported data has what you want to plot with PROC BOXPLOT.

cynthia
Ask a Question
Discussion stats
  • 1 reply
  • 143 views
  • 0 likes
  • 2 in conversation