View previous topic :: View next topic
|
Author |
Message |
krakesh06
New User
Joined: 05 Feb 2007 Posts: 2 Location: Pune
|
|
|
|
Hi All,
I would like to seek an information from you all on how to write a SAS JCL. Can I get a sample of a SAS JCL.
I will be using the SAS programming for all the data manipulation (DML) tasks.
Thanks
Rakesh |
|
Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
You need to ask YOUR site support people. They are the ones that set it all up.
How are we supposed to know which load libraries or JCL PROCS they have defined. |
|
Back to top |
|
 |
superk
Global Moderator

Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Usually you just execute the SAS PROC:
//SASSTEP EXEC SAS
//SYSIN DD *
sas code ...
/*
//* |
|
Back to top |
|
 |
PeterHolland
Global Moderator

Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Hope you can use this SAS jcl (it worked for me) :
Code: |
//STEP03 EXEC PGM=SASXA1, 00020000
// PARM='SORT=4', 00030000
// REGION=6M 00040000
//NULLPDS DD DSN=&&NULLPDS, 00050000
// DISP=(MOD,PASS), 00060000
// UNIT=SYSDA, 00070000
// SPACE=(TRK,(1,1,1)), 00080000
// DCB=BLKSIZE=6160 00090000
//STEPLIB DD DSN=*.NULLPDS, 00100000
// DISP=(SHR,PASS), 00110000
// VOL=REF=*.NULLPDS 00120000
// DD DSN=xxxxx.SAS.SASLOAD, 00130000
// DISP=SHR 00140000
// DD DSN=xxxxxxxx.xxxxxxxx.xx.SAS.LOADLIB, 00150000
// DISP=SHR 00160000
//CONFIG DD DSN=xxxxxxxx.SASA3##1.SASCONF(SAS609B), 00170000
// DISP=SHR 00180000
// DD DSN=NULLFILE, 00190000
// DISP=SHR 00200000
//SASAUTOS DD DSN=*.NULLPDS, 00210000
// DISP=(SHR,PASS), 00220000
// VOL=REF=*.NULLPDS 00230000
// DD DSN=xxxxxxxx.SAS.SASAUTO, 00240000
// DISP=SHR 00250000
//SASHELP DD DSN=xxxxxxxx.SAS.SASHELP, 00260000
// DISP=SHR 00270000
//SASMSG DD DSN=xxxxxxxx.SAS.SASMSG, 00280000
// DISP=SHR 00290000
//WORK DD DSN=xxxxxxxx.WORK.xxxxxxxx, 00300000
// DISP=(,DELETE), 00310000
// UNIT=DASD, 00320000
// AVGREC=K, 00330000
// SPACE=(32256,(50,5)), 00340000
// DCB=BLKSIZE=0 00350000
//FT11F001 DD SYSOUT=* 00360000
//FT12F001 DD SYSOUT=* 00370000
//FT15F001 DD DATACLAS=DCALNM, 00380000
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=400,BUFNO=1) 00390000
//SYSUDUMP DD SYSOUT=P 00400000
//OPCCP DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(0), 00410000
// DISP=SHR 00420000
//OPCLTP DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(0), 00430000
// DISP=SHR 00440000
//WS DD DSN=xxxxxxxxxxxxxxxxx, 00450000
// DISP=SHR 00460000
//AD DD DSN=xxxxxxxxxxxxxxxxx, 00470000
// DISP=SHR 00480000
//MACLIB DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxx, 00490000
// DISP=SHR 00500000
//PSBXREF DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00510000
// DISP=SHR 00520000
//PROCOPT DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00530000
// DISP=SHR 00540000
//DDNAMES DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00550000
// DISP=SHR 00560000
//DBDXREF DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00570000
// DISP=SHR 00580000
//DBDLIST DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00590000
// DISP=SHR 00600000
//PSBLIST DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00610000
// DISP=SHR 00620000
//DEDBLIST DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00630000
// DISP=SHR 00640000
//TRANSA1 DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 00650000
// DISP=SHR 00660000
//TRANSA3 DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00670000
// DISP=SHR 00680000
//TRANSFC DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00690000
// DISP=SHR 00700000
//TRANSFG DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00710000
// DISP=SHR 00720000
//JCLCHECK DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00730000
// DISP=SHR 00740000
//PROCTAB DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00750000
// DISP=SHR 00760000
//DYNLIBS DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00770000
// DISP=SHR 00780000
//CCDLIBS DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00790000
// DISP=SHR 00800000
//JCLLIBS DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00810000
// DISP=SHR 00820000
//DYNMEM DD DISP=MOD, 00830000
// DATACLAS=DCALNS, 00840000
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=6160) 00850000
//CCDMEM DD DISP=MOD, 00860000
// DATACLAS=DCALNS, 00870000
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=6160) 00880000
//SASLIB DD DSN=xxxxxxxx.SYN.SASSORT, 00890000
// DISP=SHR 00900000
//SYSIN DD DSN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 00910000
// DISP=SHR
|
|
|
Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Peter, it failed for me
STEPLIB +001 Dataset not found
 |
|
Back to top |
|
 |
PeterHolland
Global Moderator

Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Expat,
thats a very nice one.  |
|
Back to top |
|
 |
krakesh06
New User
Joined: 05 Feb 2007 Posts: 2 Location: Pune
|
|
|
|
expat wrote: |
You need to ask YOUR site support people. They are the ones that set it all up.
How are we supposed to know which load libraries or JCL PROCS they have defined. |
----------
I just want a model of it, I will take care of the libraries name you can write any dummy library name. I wanted to know the possible ways of writing a SAS JCL, in case of passing parameters to program , using SYSIN DD * for passing data etc.....
Thanks for all of your information.
Thanks
Rakesh |
|
Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
I just want a model of it, I will take care of the libraries name you can write any dummy library name. I wanted to know the possible ways of writing a SAS JCL, in case of passing parameters to program , using SYSIN DD * for passing data etc..... |
I have no idea what you mean by this. The simplest way to write SAS JCL is (as Kevin showed):
Code: |
// EXEC SAS
//SYSIN DD *
<SAS statements>
/*
|
If you need to read a file, or write a file, you may need the DD statement for the file (depending upon how you write your SAS code, however, that is not a requirement). SAS has a wide set of parameters that can be set for various reasons, and they can be passed by PARM= or a SAS OPTIONS ... ; statement. Production code rarely uses SYSIN for passing data since the SAS code is read from SYSIN.
As far as the procedure posted by PeterHolland, it is a version 6.09 procedure and therefore dates back many years (2001 or 2002 if I remember correctly). The current release of SAS is 9.2 and the SAS JCL procedure was completely rewritten either in SAS 9.1.3 or 9.2 . Hence if you're using one of these releases you would be better off contacting your site support group for assistance.
If you explain better just what you are looking for, we probably could help you better. Since SAS can be invoked from TSO or a batch job or on a PC or on a Unix machine, you need to clarify your question. |
|
Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
I hate to be pedantic (well sort of ), but, I tried EXEC SAS and it failed because the PROC here is called by a different name.
That is why I suggested that the OP spoke to the people who actually set the darned thing up.
At one site we had EXEC SAS8 and EXEC SAS9 until the conversion was completed when SAS8 suddenly disappeared one dark night |
|
Back to top |
|
 |
PeterHolland
Global Moderator

Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
At our company nested procs were not allowed, hence the jcl i showed.
(by the way expat EXEC SAS worked all the time, but proc naming
is site depending i guess).
And im not sure that the SAS procs (delivered by SAS) were totally rewritten for new versions like Robert states, I really would like to see
a sample of that. |
|
Back to top |
|
 |
poorani M
New User
Joined: 02 Sep 2010 Posts: 1 Location: Chennai
|
|
|
|
If you are looking out for examples to plug into the SYSIN in the jcl, this would be helpful:
//step1 EXEC SAS
//FT12F001 DD SYSOUT=<output dataset Name>
//IN1 DDDSN=<input dataset name>,DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
OPTIONS PAGESIZE=24;
DATA INPUT;
INFILE IN1 LENGTH=LINELEN;
INPUT @01 PRODUCT ABC.;
PROC FREQ DATA=INPUT;
TITLE 'FREQUENCY OF PRODUCTS ';
TABLES PRODUCT;
RUN;
//*
//*
The above JCL tries to pull the frequency of various products. The frequency is the number of times the value appears for the product. The output is obtained as below
The FREQ Procedure
Cumulative Cumulative
PRODUCT Frequency Percent Frequency
------------------------------------------------------------
1 3310 8.37 3310 8.37
2 1111 2.81 4421 11.18
3 4340 10.98 8761 22.16
4 2242 5.67 11003 27.82
45 540 1.37 11543 29.19
etc... |
|
Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
poorani M
You have resurected a happily dormant topic with a response that bears absolutely no corelation to the original problem.
Any particular reason ? |
|
Back to top |
|
 |
|
|