Hi, This should be an easy one. I am trying to run proc contents as written below...
/*Count of sterilization failures by type by diagnosis*/
data deliveries;
set 'H:Deliveries\pcori_preg_diag_final.sas7bdat';
run;
proc contents;
deliveries;
run;
And I am getting this error message:
4 proc contents;
NOTE: Writing HTML Body file: sashtml.htm
5 deliveries;
----------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
6 run;
What am I missing?
Thank you!
There is no need to make a copy of your data first before asking PROC CONTENTS (or any other proc) to use it.
proc contents data='H:\deliveries\pcori_preg_diag_final.sas7bdat';
run;
Remember to start your paths with \ or else Windows will treat them as relative, even when prefixed with a drive letter.
@mcgannmary1 wrote:
I have no idea how that smiley face showed up in my code!
when pasting or typing SAS code, you need to first click on the running man icon and then type or paste your code into that window. Then the forum software will format the text as actual SAS code, and the colon followed by right-parenthesis (or colon follow by letter D, etc.) will not be intrepreted as a smiley face.
Thank you!
proc contents data=deliveries;
run;
It's not common to see the full path in your SET statement. It's more usual to see a libname referenced and then youcopy the data set over to use.
libname source 'H:\Deliveries\';
data deliveries;
set source.pcori_preg_diag_final;
run;
proc contents data=deliveries;
run;
There is no need to make a copy of your data first before asking PROC CONTENTS (or any other proc) to use it.
proc contents data='H:\deliveries\pcori_preg_diag_final.sas7bdat';
run;
Remember to start your paths with \ or else Windows will treat them as relative, even when prefixed with a drive letter.
Thank you for your speedy reply.
The code you shared worked!:)
@mcgannmary1 wrote:
108 proc freq;
109 category;
--------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
110 run;
It's not clear what you are trying to do here in PROC FREQ, as there is no such thing as a CATEGORY statement in PROC FREQ.
Since this is independent of your earlier problem with PROC CONTENTS, you probably ought to start a new thread on this, rather than discuss it here.
Most procs will support the DATA= option on the PROC statement. But when in doubt look at the documentation for the PROC.
For PROC FREQ you need to use a TABLES statement to list of variables (or variable combinations) that you want to analyze.
proc freq data=deliveries;
tables category;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: