DATA Step, Macro, Functions and more

Linesize for Proc Print output

Accepted Solution Solved
Reply
Regular Contributor
Posts: 212
Accepted Solution

Linesize for Proc Print output

[ Edited ]

Now that I have my data setup corrently I'm trying to make it all fit on one page in the Results Viewer.  Right now I have too many columns for them all to fit on one line so each observation is basically broken in half.  How can I correct this?

 

I've tried this but the output seems unchanged:

 

options linesize=130;
proc print data=FinalData;
format Rule_Order best6.;
run;

 

The SAS System 


                                          RULE_                 _03_21_  _03_26_  _03_28_  _03_24_  _03_31_  _04_01_  _04_02_  
 Obs RULE_NM                              ORDER  _NAME_  TOTAL    2016     2016     2016     2016     2016     2016     2016   
                                                                                                                               
   1 ACS COA EXCL APPOINTMENT MISMATCH       61    N         4       1        2        1        .       .        .        .    
   2 ACS NIXIE EXCL INDICATOR MISMATCH       56    N        11       .        5        1        2       1        1        1    
   3 ACTUAL DELIVERY DATE LATER IN IV       1.5    N       202      12       12        7       18       4        7        8    
   4 ACTUAL DELIVERY DATE MISMATCH            2    N       295       .        .        .        1       .        .        .    
   5 ACTUAL DELIVERY DATE MISSING IN IV       1    N        80       .        .        .        .       .        .        .    
   6 ACTUAL ENTRY DATETIME MISMATCH           4    N        28       1        9        3        .       .        .        .    
   7 ACTUAL ENTRY DATETIME MISSING IN I     3.5    N         4       .        1        .        .       .        .        .    
   8 CAIR SCAN INDICATOR MISMATCH           317    N         5       .        1        2        .       .        .        .    
   9 CONTAINER LEVEL CODE MISMATCH          336    N       405       .      127       89        1      37       24       12    
  10 CRITICAL ENTRY TIME MISMATCH             6    N       825     686        3        1       10       .        .        .    
  11 EPFED FAC TYPE CODE MISMATCH            20    N         2       .        .        .        .       .        .        .    
  12 EXCLUDED IN IV INCLUDED IN BIDS      999.4    N       184      10       29        9       12       2        .        .    
  13 FACILITY EXCLUSION INDICATOR MISMA     110    N         2       .        .        .        .       .        .        .    
  14 FEDEX AIR SCAN INDICATOR MISMATCH      307    N         1       .        1        .        .       .        .        .    
  15 FIRST OFD SCAN DATETIME MISMATCH       326    N         6       .        1        .        .       .        .        .    
  16 FIRST SCAN DATETIME MISMATCH           300    N        24       4        2        3        2       .        .        .    
                                                                                                                               
     _03_15_  _03_17_  _03_18_  _03_19_  _03_22_  _03_23_  _03_25_  _03_29_  _03_30_        _03_14_  _03_16_  _04_04_  _03_09_ 
 Obs   2016     2016     2016     2016     2016     2016     2016     2016     2016   NULL    2016     2016     2016     2016  
                                                                                                                               
   1      .        .        .        .        .        .        .       .        .       .      .         .       .       .    
   2      .        .        .        .        .        .        .       .        .       .      .         .       .       .    
   3      1        1        2        6        4        7      110       2        1       .      .         .       .       .    
   4      .        .        .        .        .        .        1       .        .     293      .         .       .       .    
   5      3       13       20       19        4        .        2       .        .       .      5        14       .       .    
   6      .        .        .        .        .        .       15       .        .       .      .         .       .       .    
   7      .        .        .        .        .        .        1       .        .       2      .         .       .       .    
   8      .        .        .        .        .        .        1       .        .       1      .         .       .       .    
   9      .        .        .        .        .        .        3      56       47       .      .         .       9       .    
  10      .        .        1       65       46        4        1       .        .       4      .         4       .       .    
  11      .        .        .        .        .        .        2       .        .       .      .         .       .       .    
  12      3       13       22       24        7        8       25       1        .       .      5        14       .       .    
  13      .        .        .        .        .        .        .       .        .       .      .         .       .       2    
  14      .        .        .        .        .        .        .       .        .       .      .         .       .       .    
  15      .        .        .        .        .        .        5       .        .       .      .         .       .       .    
  16      .        .        .        .        4        2        6       1        .       .      .         .       .       .    

 

 


Accepted Solutions
Solution
‎04-12-2016 12:16 PM
Super User
Posts: 11,343

Re: Linesize for Proc Print output

Posted in reply to buechler66

buechler66 wrote:

ODS tagsets.ExcelXP to generate an Excel compliant XML document sounds great.  How do I specify this for my Proc Print?


The basic approach is simple:

 

ODS tagsets.ExcelXp file="C:\path\MyFile.xml";

 

proc print data = ...;

run;

 

ods tagsets.ExcelXp close;

 

You can spedify an ODS style and there are a number of options related to other appearance controls.

For more control you can provide style overrides for each variable including use of an option called TagAttr to control appearance to some extent within Excel.

View solution in original post


All Replies
Super User
Posts: 11,343

Re: Linesize for Proc Print output

Posted in reply to buechler66

Which ODS destination are you sending this to?

 

If you send to RTF or PDF you can use a style with a smaller font and set the page orientation to landscape to get wider output to fit on a page.

 

Or use ODS tagsets.ExcelXP to generate an Excel compliant XML document.

Regular Contributor
Posts: 212

Re: Linesize for Proc Print output

umm, I'm not specifying anything, it's just appearing in the Results Viewer window.
Regular Contributor
Posts: 212

Re: Linesize for Proc Print output

[ Edited ]

ODS tagsets.ExcelXP to generate an Excel compliant XML document sounds great.  How do I specify this for my Proc Print?

Solution
‎04-12-2016 12:16 PM
Super User
Posts: 11,343

Re: Linesize for Proc Print output

Posted in reply to buechler66

buechler66 wrote:

ODS tagsets.ExcelXP to generate an Excel compliant XML document sounds great.  How do I specify this for my Proc Print?


The basic approach is simple:

 

ODS tagsets.ExcelXp file="C:\path\MyFile.xml";

 

proc print data = ...;

run;

 

ods tagsets.ExcelXp close;

 

You can spedify an ODS style and there are a number of options related to other appearance controls.

For more control you can provide style overrides for each variable including use of an option called TagAttr to control appearance to some extent within Excel.

Regular Contributor
Posts: 212

Re: Linesize for Proc Print output

[ Edited ]

It should be producing the file c:\FinalData.xml?  No file is being created. We are running SAS 9.3 on Windows 7.  My results are still outputing to the Results Viewer window.

 

9248
9249  proc sort data=FinalData;
9250  by descending total descending rule_nm;
9251
9252  ods tagsets.excelxp file="c:\FinalData.xml";
NOTE: Writing TAGSETS.EXCELXP Body file: c:\FinalData.xml
NOTE: This is the Excel XP tagset (Compatible with SAS 9.1.3 and above, v1.122, 01/04/2011). Add options(doc='help') to the
ods statement for more information.

NOTE: There were 38 observations read from the data set WORK.FINALDATA.
NOTE: The data set WORK.FINALDATA has 38 observations and 24 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.09 seconds
      cpu time            0.07 seconds


9253  proc print data=FinalData;
9254      format Rule_Order best6.;
9255  run;

NOTE: There were 38 observations read from the data set WORK.FINALDATA.
NOTE: The PROCEDURE PRINT printed pages 377-378.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.21 seconds
      cpu time            0.12 seconds


9256  ods tagsets.excelxp close;
9257

 

Super User
Posts: 11,343

Re: Linesize for Proc Print output

Posted in reply to buechler66

Try a folder other that the root of drive C. You might not have write privileges there.

 

Also, if you are running this in a Server environment you need to point to a location the server has write privileges. And the path would be relative from the server, so you might a file on the server (that you likely can't see there either).

Regular Contributor
Posts: 212

Re: Linesize for Proc Print output

[ Edited ]

What can I possibly be doing wrong?  Again no error, but the file still is not created.  Any other suggestions?

 

306  proc sort data=FinalData;
307  by descending total descending rule_nm;
308
309  ods tagsets.excelxp file="c:\users\ssbuechl\FinalData.xml";
NOTE: Writing TAGSETS.EXCELXP Body file: c:\users\ssbuechl\FinalData.xml
NOTE: This is the Excel XP tagset (Compatible with SAS 9.1.3 and above, v1.122, 01/04/2011). Add options(doc='help') to the
ods statement for more information.

NOTE: There were 40 observations read from the data set WORK.FINALDATA.
NOTE: The data set WORK.FINALDATA has 40 observations and 25 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.16 seconds
      cpu time            0.08 seconds


310  proc print data=FinalData;
311      format Rule_Order best6.;
312  run;

NOTE: There were 40 observations read from the data set WORK.FINALDATA.
NOTE: The PROCEDURE PRINT printed pages 10-11.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.22 seconds
      cpu time            0.13 seconds


313  ods tagsets.excelxp close;
314

 

The output is still going to the Results Viewer...

 

                                          RULE_         _04_01_  _04_05_  _04_06_  _04_08_  _03_28_  _03_31_  _03_26_  _04_02_ 
 Obs RULE_NM                              ORDER  TOTAL    2016     2016     2016     2016     2016     2016     2016     2016  
                                                                                                                               
   1 TOTAL BIDS VOLUME SAMPLED            999.3  54504   23024     1092     493      143      2210     2157     1171    13883  
   2 VOLUME MATCHING                      999.2  35176   21393       68      44        9      1457     1745     1092     4244  
   3 PREP TYPE CODE MISMATCH                337  15588     395      908     396      110        54      227       11     9196  
   4 EXCLUDED IN IV INCLUDED IN BIDS      999.4    870     430       18       1        .        12       52       13      152  
   5 CRITICAL ENTRY TIME MISMATCH             6    751       .        .       .        .       670        3       60        .  
   6 ACTUAL ENTRY DATETIME MISSING IN I     3.5    746     363       22       1        .         4       41        4      133  
   7 FSS SCAN INDICATOR MISMATCH            328    725     430        4       3        .         .       93        .       25  
   8 CONTAINER LEVEL CODE MISMATCH          336    411      10       60      42       16         3       14        .      139  
   9 INCLUDED IN IV EXCLUDED IN BIDS      999.5    247      33        4       .        .         2        .        .       30  
  10 ACTUAL DELIVERY DATE MISMATCH            2    205       9        3       3        .         .        .        .        3  
  11 ACTUAL DELIVERY DATE MISSING IN IV       1    123      26        .       .        .         5        4        .        3  
  12 LAST SCAN DATETIME LATER IN BIDS         3    104      85        4       1        .         .        3        .        3  
  13 ACTUAL DELIVERY DATE LATER IN IV       1.5     95      68        .       .        1         1       11        1        4  
  14 FIRST SCAN DATETIME MISMATCH           300     92      26        2       .        .         1        1        .       14  
  15 ACTUAL ENTRY DATETIME MISMATCH           4     92      41        8       1        .         .        2        .       26  
  16 PIECES MISSING IN IV                 999.1     73      26        1       .        .         7        .        3       25  
                                                                                                                               
     _04_04_  _04_09_  _03_30_  _04_07_  _04_11_        _03_14_  _03_19_  _03_29_  _03_25_  _03_21_  _03_22_  _03_23_  _03_24_ 
 Obs   2016     2016     2016     2016     2016   NULL    2016     2016     2016     2016     2016     2016     2016     2016  
                                                                                                                               
   1   4707     124      725      222       17    3303     1        3       875      252       4        4        2        92   
   2    512       7      554       14        3    3022     .        1       665      246       3        3        2        92   
   3   3975      90       11      184        4       3     .        .        23        1       .        .        .         .   
   4     75       1       49        2        .       .     1        2        62        .       .        .        .         .   
   5      .       .        .        .        .       2     .        .        15        1       .        .        .         .   
   6     73       1       23        2        .      68     .        .        11        .       .        .        .         .   
   7     10       .       65        .        .       .     .        .        93        2       .        .        .         .   
   8     92      12        2       20        1       .     .        .         .        .       .        .        .         .   
   9      7       .        .        .        .     169     .        .         2        .       .        .        .         .   
  10      2       4        1        1        5     174     .        .         .        .       .        .        .         .   
  11      1       .       28        .        .       .     1        2        53        .       .        .        .         .   
  12      1       4        1        1        .       .     .        .         .        1       .        .        .         .   
  13      4       5        .        .        .       .     .        .         .        .       .        .        .         .   
  14      3       .       30        .        .       .     .        .        13        .       1        1        .         .   
  15      5       1        .        .        .       8     .        .         .        .       .        .        .         .   
  16      6       .        1        .        .       3     .        .         .        1       .        .        .         .   

 

 

Super User
Posts: 19,867

Re: Linesize for Proc Print output

Posted in reply to buechler66

Yes it does matter that it's an rsubmit block. 

This means the file will be saved to the server, not your local drive. 

You can ftp it to your local drive usually. 

 

You also haven't turned off ODS listing - so you'll get both the listing output AND the xml file. I'm assuming the XML file wasn't generated in the location anyways.

Regular Contributor
Posts: 212

Re: Linesize for Proc Print output

Does it matter that my program is running on the server-side within an Rsubmit block? Do I need to somehow bring the dataset FinalData to my local Windows machine?
Regular Contributor
Posts: 212

Re: Linesize for Proc Print output

Posted in reply to buechler66
Now working outside the Rsubmit. Thanks to all for the help!
Super User
Posts: 19,867

Re: Linesize for Proc Print output

Posted in reply to buechler66

There wasn't an error that showed up, it said writing to the file. 
Did you navigate to that location and not find the XML file? The log doesn't indicate an issue and in fact states it's writing to that location. If you do see it there open Excel and then open the XML file from within Excel. 

 

You will still see the results to your main window unless you turn it off. 

 

ODS LISTING appears to be your default. 

 

ODS HTML will generate HTML files that can show in the browser or you can create external files to view as well.

 

Here's the link to the demo on Tagsets:

https://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html

 

You appear to have an old version of the tagsets, probably what shipped with your version of SAS. You can update it by downloading the linked file here (under ExcelXP). Its a TPL file, but its really SAS code, just open it and run it in your SAS editor window. 

https://support.sas.com/rnd/base/ods/odsmarkup/index.html

 

Super Contributor
Posts: 394

Re: Linesize for Proc Print output

Posted in reply to buechler66

It may be that you can't. The Results Window respects the LINESIZE option. Try setting LINESIZE=MAX. MAX is 256 characters. If your observation is too wide to fit in 256 characters then you're stuck. In that case, take @ballardw's suggestion and route your output to another destination (such as HTML) which allows lines longer than 256.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 12 replies
  • 721 views
  • 3 likes
  • 4 in conversation