Help using Base SAS procedures

Varying DESCRIBE line length

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

Varying DESCRIBE line length

[ Edited ]

I am  doing

proc sql;
           describe table &lib..&mem
        ;quit;

 

.. where I write the log the log to a file:

 

%let logfile=C:\SAS_table.log;

proc printto log="&logfile" new;

 

 

The other day, it output a full line like this  (no new lines)

create table SASHELP.BURROWS( label='Isopod Burrow Locations and Covariates from an Israeli Desert' bufsize=65536 )

 

Today, it is breaking it into 2 lines:   where there is a new line  before  'bufsize=65536 )'

 

create table SASHELP.BURROWS( label='Isopod Burrow Locations and Covariates from an Israeli Desert'
bufsize=65536 )

 

I have made no changes to the code and no one else has made system changes.

I tried using   LINESIZE=MAX, but has no effect.

 

Is there a way to make this a fixed length?


Accepted Solutions
Solution
‎04-28-2017 10:22 AM
Occasional Contributor
Posts: 8

Re: Varying DESCRIBE line length

Tom, that worked!  Actually, I had tried setting the LS  option, but I did it higher in the program,  where it obviously did not affect this particular code.   Thank you!

View solution in original post


All Replies
Super User
Super User
Posts: 7,942

Re: Varying DESCRIBE line length

Posted in reply to dougcrites

I would recommend that, whenever you need output, to write a report and put that into a file.  Log/Output window, they are plain text and don't have the necessary functionality to create nice outputs.

You can do it simply by:

proc report data=sashelp.vtable nowd;
  columns _all_;  /* You can choose what columns */
run;

proc report data=sashelp.vcolumns nowd;
  columns _all_;
run;
Occasional Contributor
Posts: 8

Re: Varying DESCRIBE line length

From what I understand, the DESCRIBE output always goes to the log, so I don't know any other way to direct it to a 'report'.  (I'm still quite new with SAS)..   The best I was able to do to retain this info, was to divert the log to a file.

Super User
Super User
Posts: 7,942

Re: Varying DESCRIBE line length

Posted in reply to dougcrites

Why do you need describe?  The two proc reports I gave you, SASHELP.VTABLE, SASHELP.VCOLUMN, contain the metadata of all the tables and columns - this is the SAS version of describe.  You can get the information directly from there.

Occasional Contributor
Posts: 8

Re: Varying DESCRIBE line length

We could probably work with the table metadata like that... but for views,  the describe gives us the definition of the views which suits our purposes. I can't get that with a report of VVIEW.

Super User
Super User
Posts: 7,942

Re: Varying DESCRIBE line length

Posted in reply to dougcrites

I think your likely stuck with the output the way it is then, unless you want to re-direct it into a datastep and process it that way.  

Occasional Contributor
Posts: 8

Re: Varying DESCRIBE line length

OK, thanks for your quick responses. 

Super User
Super User
Posts: 7,039

Re: Varying DESCRIBE line length

Posted in reply to dougcrites

It should work to change the LS option. Try this example.

data BURROWS( label='Isopod Burrow Locations and Covariates from an Israeli Desert' bufsize=65536 ) ;
 x=1;
run;

filename log1 temp ;

proc printto log=log1 new ; run;
proc sql ;
options ls=80 ;
  describe table work.burrows;
options ls=132 ;
  describe table work.burrows;
quit;
proc printto log=log ; run;
data _null_;
  infile log1 ;
  input;
  put _infile_;
run;

Results

1511  proc sql ;
1512  options ls=80 ;
1513    describe table work.burrows;
NOTE: SQL table WORK.BURROWS was created like:

create table WORK.BURROWS( label='Isopod Burrow Locations and Covariates from
an Israeli Desert' bufsize=65536 )
  (
   x num
  );

1514  options ls=132 ;
1515    describe table work.burrows;
NOTE: SQL table WORK.BURROWS was created like:

create table WORK.BURROWS( label='Isopod Burrow Locations and Covariates from an Israeli Desert' bufsize=65536 )
  (
   x num
  );

1516  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


1517  proc printto log=log ; run;
NOTE: 33 records were read from the infile LOG1.
Solution
‎04-28-2017 10:22 AM
Occasional Contributor
Posts: 8

Re: Varying DESCRIBE line length

Tom, that worked!  Actually, I had tried setting the LS  option, but I did it higher in the program,  where it obviously did not affect this particular code.   Thank you!

☑ This topic is solved.

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

Discussion stats
  • 8 replies
  • 220 views
  • 0 likes
  • 3 in conversation