IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Increase the width of the column greater than 256 in SAS


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue May 12, 2015 6:20 pm
Reply with quote

Hi,

Can some one tell if there is any way to give the length of the column in SAS greater than 256 my column needs 540 length but that is showing error when i try to execute with 540.

Thanks
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue May 12, 2015 6:23 pm
Reply with quote

How about showing your code and the full message you got?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue May 12, 2015 11:03 pm
Reply with quote

Your post is not clear -- are you talking about a PROC SQL column? a SAS variable? something else entirely? With SAS variables, you can use a LENGTH statement to make a character variable anything up to 32767 bytes.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue May 12, 2015 11:20 pm
Reply with quote

Robert Sample wrote:
Your post is not clear -- are you talking about a PROC SQL column? a SAS variable? something else entirely? With SAS variables, you can use a LENGTH statement to make a character variable anything up to 32767 bytes.



I am talking about the SAS variable. I declared it using the LENGTH but still its shows an error message.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue May 12, 2015 11:35 pm
Reply with quote

Show us your SAS code.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Wed May 13, 2015 12:18 am
Reply with quote

Here is my SAS code below:

Code:


//STEP05    EXEC    SAS
//INPFILE    DD       DSN=&&TEMP,DISP=SHR
//OUTPFLE   DD      DSN=FILE1.NAME,DISP=SHR
//SYSIN       DD     *                           
   OPTIONS  NODATE NONUMBER NOCENTER LINESIZE=256 MISSING=' ';
   TITLE;
   DATA  FILE1;
   INFILE  INPFILE;
   INPUT
      @1    CTYPE      $3.
      @4    C1           $1.
      @5    JNAME      $8.
      @13  C2            $1.
      @14  OWNER     $3.
      @17  C3            $1.
      @18 TNAME       $7.                                               
      @25  C4            $1.
      @26  DESC        $27.
      @53  C5            $1.
      @54  WDAYS     $30.
      @84  C6            $1.
      @85  CAL          $3.
      @88  C7            $1.
      @89  ALERT       $4.
      @93  C8            $1.
      @94  MAXWAIT  $1.
      @95  C9            $1.
      @96  JOBS        $8.
      @105 C10         $1.
      @106 COND      $19.
      @125 C11         $1.
      @126 FRMTIME  $4.
      @130 C12         $1.
      @131 SETV       $4.
      @135 C13         $1.
      @136 NPD         $1.
      @137 C14         $1.
      @138 EXSD       $4.
      @142 C15         $1.
      @143 RCD         $4.                       
      @147 C16         $1.
      @148 JOBNAME $8.

DATALINES;
RUN;
DATA FILE2;
LENGTH  C $1;
C= ',';
LENGTH CHNGTYPE   $3.;
LENGTH JBNAME     $8.;
LENGTH  OWNERID   $3.;
LENGTH   TABNAME  $8.;
LENGTH   DESCRIPTION   $540.;
LENGTH    WORKINGDAYS   $120.;
LENGTH     CALENDAR    $3.;
LENGTH    ALERTTYPE   $4.;
LENGTH     MAXWAIT   $4.;
LENGTH    CONDITION   $480.;
LENGTH    FROMTIME   $4.;
LENGTH      SETVARIABLE   $4.;
LENGTH      RUNPERDAY     $1.;
LENGTH    EXCLUSIVESHRD    $4.;
LENGTH    RETURNCODE    $4.;

DO UNTIL(LAST.JOBNAME);
     SET FILE1;
     BY JOBNAME NOTSORTED;
     CHNGTYPE=CATX(' ',CHNGTYPE,CTYPE);
     JBNAME=CATX(' ',JBNAME,JNAME);
     OWNERID=CATX(' ',OWNERID,OWNER);
     TABNAME=CATX(' ',TABNAME,TNAME);
     DESCRITION=CATX(' ',DESCRIPTION,DESC);
     WORKINGDAYS=CATX(' ',WORKINGDAYS,WDAYS);
     CALENDAR=CATX(' ',CALENDAR,CAL);
     ALERTTYPE
     MAXWAIT
     CONDITION
     FROMTIME
     SETVARIABLE
     RUNPERDAY
    EXCLUSIVESHRD
    RETURNCODE
    ;
RUN;

FILE OUTPFLE;
PUT
@1  CHNGTYPE $3.
@4  C  $1.
@5     JBNAME   $8.
@13   C $1.
@14    OWNERID   $3.
@17   C  $1.
@18    TABNAME   $8.
@26   C $1.
@27   DESCRIPTION    $540.
@567 C $1.
@568   WORKINGDAYS  $120.
@688   C  $1.
@689    CALENDAR $3.
@692    C $1.
@693   ALERTTYPE    $4.
@697     C  $1.
@698   MAXWAIT   $1.
@699    C $1.
@700    CONDITION  $480.
@1180   C   $1.
@1181    FROMTIME    $4.
@1185    C    $1.
@1186   SETVARIABLE    $4.
@1190      C   $1.
@1191   RUNPERDAY    $1.
@1192   C   $1.
@1193  EXCLUSIVESHRD  $4.
@1197   C   $1.
@1198  RETURNCODE   $1.
;
PROC REPORT  DATA=FILE2 NOWINDOWS;
RUN;





The same code syntax is used for ALERTTYPE to RETURNCODE as well like above used CATX syntax.



And I get error like "the width of the "variable" is not between 1 and 256 adjust the column width or the line size.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Wed May 13, 2015 12:23 am
Reply with quote

Also I ran the code by removing LINESIZE=256 in the OPTIONS but even then I get the same error message...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed May 13, 2015 3:49 am
Reply with quote

Rather than telling us what the error is "like" -- post the code with the error message in it as it helps us to see where SAS considers the problem to lie. And by the way, LINESIZE has nothing to do with variable widths -- LINESIZE tells SAS how long each line of the SAS log is.

It would also help if you describe (with a few input records) what your input consists of and what you are attempting to produce for output. It appears you are attempting to create a comma-delimited file from the input; if so, why not use PROC EXPORT? Why do you think you need the CATX function?
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Wed May 13, 2015 11:50 am
Reply with quote

Robert Sample wrote:
Rather than telling us what the error is "like" -- post the code with the error message in it as it helps us to see where SAS considers the problem to lie. And by the way, LINESIZE has nothing to do with variable widths -- LINESIZE tells SAS how long each line of the SAS log is.

It would also help if you describe (with a few input records) what your input consists of and what you are attempting to produce for output. It appears you are attempting to create a comma-delimited file from the input; if so, why not use PROC EXPORT? Why do you think you need the CATX function?


The below is the error message which I got :

Code:


111          PROC REPORT DATA=FILE2 NOWINDOWS;
112          RUN;

ERROR: The width of DESCRIPTION is not between 1 and 256. Adjust the column widt
NOTE: This affects LISTING output.



and my input records wil be like below:

Code:


A,         ,C,D1,E,F
              D2   F
              D3   F
   B1 IN           F
   B2 IN           F
   B3 IN           F



output dataset will have

Code:


A,B1 IN B2 IN B3 OUT,C,D1 D2 D3,E,F



so here the column width of the B1 IN B2 IN B3 OUT shoulf be maximum of 480 and D1 D2 D3 should be maximum 540 but i get error for this.

I am using CATX since I need to include all the D1 D2 and D3 in the same line between the comma and the same way for other column as well.

Also I am trying to add a comma after the last IN in the each record so that B1 IN B2 IN and B3 OUT goes to two separate column in excel when it it sent mail as CSV format.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Wed May 13, 2015 1:39 pm
Reply with quote

Hello,

You would get the above error if you are trying to print anything with PROC REPORT that is over 256 characters.

The below program would produce the same error.

Code:
OPTIONS LINESIZE=256;
DATA WELLS;
LENGTH DESCRIPTION $540;
DESCRITION = "GOT INTO A BATTLE WITH AN ARMY OF ANTS FOR THE COVETED BRITTANIA RUSK, AFTER A LONG
STRUGGLE, I AM TYPING THIS LONG STRING AND THEY ARE'NT";
RUN;
PROC REPORT DATA = WELLS NOWD; RUN;


To overcome this, you could use PROC PRINT instead of PROC REPORT.

Code:
PROC PRINT  DATA=FILE2;
RUN;


Hope it helps.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Wed May 13, 2015 2:00 pm
Reply with quote

vasanthz wrote:
Hello,

You would get the above error if you are trying to print anything with PROC REPORT that is over 256 characters.

The below program would produce the same error.

Code:
OPTIONS LINESIZE=256;
DATA WELLS;
LENGTH DESCRIPTION $540;
DESCRITION = "GOT INTO A BATTLE WITH AN ARMY OF ANTS FOR THE COVETED BRITTANIA RUSK, AFTER A LONG
STRUGGLE, I AM TYPING THIS LONG STRING AND THEY ARE'NT";
RUN;
PROC REPORT DATA = WELLS NOWD; RUN;


To overcome this, you could use PROC PRINT instead of PROC REPORT.

Code:
PROC PRINT  DATA=FILE2;
RUN;


Hope it helps.


Its working now...thanks a lot..... icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts Increase the number of columns in the... IBM Tools 3
No new posts first column truncated in search result IBM Tools 13
No new posts Dataset size increase on adding 1 byt... DFSORT/ICETOOL 8
Search our Forums:

Back to Top