BookmarkSubscribeRSS Feed
gwwp
Obsidian | Level 7

I am a new SAS user using SAS Studio. In the following code I am attempting to find the mean of a column.

 

PROC IMPORT DATAFILE='/home/u61857737/my_data.csv'
DBMS=CSV
replace
OUT=Assignment1;
GETNAMES=YES;

RUN;

*assign data to dataset dt1;
data dt1;
set work.Assignment1;
run;

*mean of age for participants in study years “1999-2004”, “2005-2010” and “2011-2014” in Table 1;
proc means data=dt1 mean; *no change for work.dt1, Assignment1 or work.Assignment1;
var age;
class r1surveyyear;
run;

On run, there is no output in the results tab and I get the following errors:

ERROR: At least one file associated with fileref _HTMLOUT is still in use.
ERROR: Error in the FILENAME statement.

This error disappears when I highlight and run (sometimes twice)

PROC IMPORT DATAFILE='/home/u61857737/my_data.csv'
DBMS=CSV
replace
OUT=Assignment1;
GETNAMES=YES;

RUN;

and then run the complete code, but there is no table displayed for means and results remain blank.

 

The statement

PROC CONTENTS DATA=WORK.IMPORT; RUN;

does print out metadata tables.

What am I doing wrong here?

3 REPLIES 3
ballardw
Super User

One question: why are you running contents on Work.Import when you are creating and using Assignment1 and/or DT1? Those are the two sets that are going to have an impact on the Proc Means execution.

 

"Still in use" messages can be somewhat tricky. If you open the output with an external program that might lock it from further use by SAS. Or if you are writing to a specific file and don't close it. Or the network is just slow.

 

Since you don't show a Filename statement then this is likely related to a server setting for output and the server might just be slow to finish an update. Having to repeat running the import step to get a proper execution may be an indicator of high load on the server slowing things down.

gwwp
Obsidian | Level 7

Thank you for your reply, it's helpful to know that server issues slow SAS down. I don't know what Work.Import is for, and it's not related to the exercise I'm doing, which is why I commented it out. I'm assuming it's unnecessary here?

 

I will post a separate question regarding how to get a means output.

Reeza
Super User
*mean of age for participants in study years “1999-2004”, “2005-2010” and “2011-2014” in Table 1;

This line in your code means you're copying and pasting your code, likely from a Word document. It's adding 'smart quotes' and may also be adding other invisible characters affecting your code. 

Try typing the code out from scratch and see if it works. 

 

Also, you can turn off that feature - see the link above. 

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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