The SAS Output Delivery System and reporting techniques

SAS to LaTeX - longtable is too wide

Reply
Occasional Contributor
Posts: 9

SAS to LaTeX - longtable is too wide

[ Edited ]

Hello SAS Community,

 

With the following code:

 

clear all;
proc import
datafile='C:\Users\Shaft\Documents\France_2015_2016\M2_ETE\Master_Thesis\matthes.csv'
out=work.matthes
dbms=csv
replace;
getnames=yes;
datarow=2;
run;
data matthes2;
set matthes;

date_num=datepart(date);
format date_part yyq6.;
date_char = put(date_num, yyq6.);
run;

ods tagsets.colorlatex file="C:\Users\Shaft\Documents\France_2015_2016\M2_ETE\Master_Thesis\simps1.tex" stylesheet="sas.sty"(url="sas")
title = "Fishers Z: Interest Rate and Output Gap (After Volker)";
proc corr data=matthes2 fisher(rho0=.99) fisher(type=upper);
where date_char ge '1979Q4';
var i y;
run;
ods tagsets.colorlatex close;

 

I get a Tex file output that looks like this when compiled:

 

sasexample.png

 

I don't get any errors when I copile in Texmaker, so I'm tempted to think this is a SAS question rather than a LaTeX one.

 

Any tips? I'm very open to proposal to drastically change my code. I'm very new to this. Just trying to get basic tables to go into LaTeX from SAS.

 

Thanks so much.

 

John

Super User
Posts: 19,038

Re: SAS to LaTeX - longtable is too wide

Well the table does appear too wide to fit on the page. 

Can your change the orientation?

 

options orientation=landscape;
Occasional Contributor
Posts: 9

Re: SAS to LaTeX - longtable is too wide

Hey again Reeza -- thanks as always for your help.

 

Even with this, the table is just too big. The one thing I was able to do was to change a few words ("Corr" instead of "Correlation") to make the columns skinnier. I guess I would have thought there would be a different way to do this :/

Super User
Super User
Posts: 7,686

Re: SAS to LaTeX - longtable is too wide

Well, your output from SAS is markup, so its down to the renderer to decide how the output looks.  Personally I would always store the objects created by a proc, and then report them out both to keep the data (for validation) but also so you have the full flexibility of proc report to design a nice output - I have never seen a situation where the default output is as I would like.

ods trace on;
proc corr...;
run;
ods trace off;

You will see in the log all the objects which are created, you can them save these and proc report them:

ods output <objectname>=<datasetname>;

proc corr...;
run;

ods tagsets...
proc report data=<datasetname>...
run;
Ask a Question
Discussion stats
  • 3 replies
  • 360 views
  • 0 likes
  • 3 in conversation