BookmarkSubscribeRSS Feed
urbanix_Oslo
Fluorite | Level 6
I have tried to find an easy way to integrate SAS code and output in my latex documents. I have tried to install and use the Statrep package from http://support.sas.com/rnd/app/papers/statrep.html, but can't get it to work properly. I thus have a few questions. Several attempts have left me quite frustrated, and any help will be greatly appreciated.
 
I believe the problem has to do with sending output to and retrieving it from correct folders. I need all files to be on a network drive (\\fil-tjener\) separate from the SAS-server (d:\). The SAS-server is not accessible from file explorers or any other programs besides SAS/EG.

I would like to use these folders:
Tex-files: \\fil-tjener\Texfile
SAS-output: \\fil-tjener\Texfile\SASoutput
SAS-macros and templates: \\fil-tjener\statrep

I tried the quickstart.tex-file included in the package. It compiles (pdflatex) just fine the first time. quickstart_SR.sas and quickstart_SR_preamble.sas is generated as they should be, in \\fil-tjener\Texfile.

quickstart_SR.sas will not run as is, but if I change

%include "./quickstart_SR_preamble.sas" /nosource;
to
%include "\\fil-tjener\Texfile\quickstart_SR_preamble.sas" /nosource;
 it finds the preamblefile and runs it.

Question 1: How do I modify the tex-file so that I don't need to manually change the SAS-file to get SAS to look for the preamble file in my designated folder?
 
It does produce an error because it is looking for the SAS macro file in the wrong directory. If I change the %include-statemtent in the preamble-file to 
%include "\\fil-tjener\statrep\statrep_macros.sas" /nosource;
it does find the file containing the macros. quickstart_SR.sas will now run without errors.

Question 2: How do I modify the tex-file to have it look for statrep_macros.sas in my chosen directory?
 
While it seems runs just fine, the output is nowhere to be found. Thus figures are still missing on the second tex-compilation. The log has lines like NOTE: Writing Graph file: ./png/tstb.png
It seems output is sent to to the work directory on the SAS server instead of my chosen folder on the network drive.
 
Question 3: How do I modify the tex-file so that the SAS-ouput is sent to \\fil-tjener\Texfile\SASoutput?

Question 4: How do I modify the tex-file so that the SAS-ouput is retrieved from  \\fil-tjener\Texfile\SASoutput on the second pdflatex compilation?
 
Operating system, SAS-server: WX64_SV
Operating system, my computer: Windows 7 Enterprise.
SAS-version: 9.4_M2
Latex: Texmaker/Miktex
 
1 REPLY 1
urbanix_Oslo
Fluorite | Level 6

Never mind, I've got it working now. It's funny how some times phrasing a question helps clarify the issue enough for one to find the answer by oneself.

 

I had to include the following in the preamble of the tex-file:

\def\SRrootdir{//fil-tjener/texfile} 
\def\SRmacropath{//fil-tjener/statrep/statrep_macros.sas}

(note the slashes)

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 739 views
  • 1 like
  • 1 in conversation