2
$\begingroup$

I'm very new to SAS, so please keep that in mind with any responses.

I've been running the following code in SAS:

FILENAME fishfile URL
 "http://www.amstat.org/publications/jse/datasets/fishcatch.dat";
PROC FORMAT;
  VALUE sexfmt 0="female" 1="male";
  VALUE speciesfmt 1="common bream" 2="whitefish" 3="roach"
    4="silver bream" 5="smelt" 6="pike" 7="perch";
  INVALUE misscode "NA"=. ; 
RUN;
DATA fish;
  INFILE fishfile;
  INPUT obs species weight length1 length2 
        length3 hgtpct widpct sex;
  INFORMAT weight sex misscode.; 
  LABEL length1="Nose to tail beginning length"
        length2="Nose to tail notch length"
        length3="Nose to tail end length";
  FORMAT species speciesfmt. sex sexfmt.;
RUN;

All of the above code runs without any errors. The following code gives me errors:

TITLE "Finnish Fish: Species distribution";
PROC SGPLOT DATA=fish;
  VBAR species;
RUN;
TITLE "Finnish Fish: Weight in grams";
PROC SGPLOT DATA=fish;
  HISTOGRAM weight;
RUN;

I can't access the data right now so I don't have the specific error, but it says something along the lines of "Insufficient authorization" when I try to view the resulting plots. I will post the actual error message when I can access the data again, but until then I'm hoping that someone has encountered this error and found a solution.

$\endgroup$
2
$\begingroup$

Are you trying to open the file directly in SAS? This has caused problems for me before when working on a server. However if I open up explorer and browse to where the png file is stored (probably where your SAS program is saved) you should be able to open it from there with a variety of programs. From there I think you can isolate the program that is giving you trouble.

$\endgroup$
1
$\begingroup$

I actually figured out the issue. I'm not listed as an Administrator on my school-issued laptop. As such, I cannot save to the Program Files folder. I changed the current directory for SAS and now I can access all of my plots and other output. Thanks for all of the responses, though!

$\endgroup$
  • $\begingroup$ I'd suggest accepting your own answer, as you've clearly solved your problem. I'm rather pleased that my guess - "This is probably a file permissions problem on your PC, rather than SAS itself", seems correct. $\endgroup$ – Fomite Aug 31 '11 at 3:41
  • $\begingroup$ @EpiGrad - It took me a few error messages to actually realize what they were telling me. Next time, I will give myself a bit more time to understand the error before coming to SE. $\endgroup$ – assumednormal Aug 31 '11 at 12:08
  • $\begingroup$ Believe me, its a problem I'm well familiar with. Took me an embarrassingly long time once to figure out all the errors of an analysis were coming from me failing to use the right pathname for a file. At least it wasn't a semi-colon. $\endgroup$ – Fomite Aug 31 '11 at 21:51
1
$\begingroup$

I've solved this problem in the past by ensuring that either my SAS working directory is set to a disk I know I can write to (especially if SAS is running on an application server like Citrix) or by submitting

ODS LISTING GPATH = "C:\Documents";

For example, assuming that you can access the C:\Documents folder.

$\endgroup$
0
$\begingroup$

Which version of SAS are you running?

In v. 9.3 (the latest) this ought to open a HTML window right in your session. In 9.2, you would need "ods graphics on" before the code and "ods graphics off" afterward. However, in either version you can save the output by, e.g.

ods rtf file = "c:\myfile.rtf";

before the code and

ods rtf close;

after the code. There are other formatting options as well, including png and html and other formats.

$\endgroup$
  • 1
    $\begingroup$ You never need "ods graphics on" before an SGPLOT call. Only before statistical procs. $\endgroup$ – Rick Sep 2 '11 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.