From: montura on 26 Feb 2010 07:55 Surprise, surprise....many portions of The SAS System are written in SCL. ANYTHING you can do with Data Step and Macro can be done in SCL - batch mode and interactive. In addition, there are more command and session level resources in SCL that are not available in Base/SAS + Macro. Create a SAS dataset with SCL. Embed SQL within a submit block for the same effect. startup2: method / (description='results dataset'); dcl num dset; dset=open('belowLimitSpanSystem', 'n'); newvar(dset, 'status', 'c', 10, 'Status'); newvar(dset, 'compkeystart', 'c', 14, 'COMPKEY Start Event'); newvar(dset, 'compkeyend', 'c', 14, 'COMPKEY End Event'); newvar(dset, 'logdemo', 'c', 1, 'Log Demo'); newvar(dset, 'required', 'n', 8, 'Required Level'); newvar(dset, 'actualstart', 'n', 8, 'Actual Level Start'); newvar(dset, 'actualend', 'n', 8, 'Actual Level End'); newvar(dset, 'eventstart', 'n', 8, 'Open Event datetime', 'datetime20.'); newvar(dset, 'eventend', 'n', 8, 'Close Event datetime', 'datetime20.'); newvar(dset, 'sampidstart', 'n', 8, 'SampID Start Event'); newvar(dset, 'sampidend', 'n', 8, 'SampID End Event'); newvar(dset, 'pwsid', 'c', 7, 'PWSID'); newvar(dset, 'sourceid', 'c', 3, 'Source ID'); newvar(dset, 'epkey', 'c', 10, 'EP Key'); close(dset); endmethod; Check to see if SQL executed correctly. Grab the OBS after SQL executes for later use. interface1: method / (description='Samples by timestamp'); dcl num uniqueID=getitemn(keyVector); submit continue sql; create table work.sample as select * from belowLimitMatrix where uniqueID=&uniqueID order by sampdate, samptime; quit; endsubmit; if symgetn('sqlrc') then insertc(gMessage, description||' '||_method_, -1); insertn(gResults, symgetn('sqlobs'), -1, 'sample'); endmethod; Verify a datasets exists interface3: method; if exist('work.temp')=0 then insertc(gMessage, 'Sound RED alert', -1, 'dataset not found'); endmethod; Load a SAS dataset, one row at a time; runStoreSingle: method / (description='Low Sample Found'); dcl char compkeystart logdemo pwsid epkey sourceid; dcl num dset required actualStart eventstart idstart; compkeyStart=getnitemc(openEvent, 'compkey'); logDemo =getnitemc(openEvent, 'logdemo'); required =getnitemn(openEvent, 'requiredLevel'); actualStart =getnitemn(openEvent, 'actualLevel'); eventStart =getnitemn(openEvent, 'sampdatetime'); idStart =getnitemn(openEvent, 'sampid'); pwsid =getnitemc(openEvent, 'pwsid'); sourceid =getnitemc(openEvent, 'sourceid'); epkey =getnitemc(openEvent, 'epkey'); dset=open('belowLimitSpanSystem', 'u'); call putvarc(dset, varnum(dset, 'status'), status); call putvarc(dset, varnum(dset, 'compkeystart'), compkeyStart); call putvarc(dset, varnum(dset, 'logdemo'), logDemo); call putvarn(dset, varnum(dset, 'required'), required); call putvarn(dset, varnum(dset, 'actualStart'), actualStart); call putvarn(dset, varnum(dset, 'eventStart'), eventStart); call putvarn(dset, varnum(dset, 'sampidStart'), idStart); call putvarc(dset, varnum(dset, 'pwsid'), pwsid); call putvarc(dset, varnum(dset, 'sourceid'), sourceid); call putvarc(dset, varnum(dset, 'epkey'), epkey); append(dset, 'noinit'); close(dset); clearlist(openEvent); clearlist(closeEvent); endmethod;
From: montura on 26 Feb 2010 07:59 One clarification - you are running EG but do you have SAS/AF on your system? If you have SAS/AF you can simply code SCL programs. Without SAS/AF you would be limited to that mess posted earlier.
From: Clark An on 27 Feb 2010 02:24 Thank you for your kindly reply,but I still wanna find a solution for this problem.Cheers!
From: Clark An on 27 Feb 2010 02:29 Very interesting.
From: xlr82sas on 27 Feb 2010 18:23 Hi Montura Thanks for your comments. It is always good to get others opinions. I tried to run your code from the old SAS editor, the EE editor and EG and it failed on each. Here is the error I got on the old editor 58 59 60 61 startup2: method / (description='results ------ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 62 dataset'); 63 dcl num --- 180 ERROR 180-322: Statement is not valid or it is used out of proper order. ============================== ============================= ============================= Here is the error I got in EE 164 startup2: method / (description='results ------ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 165 dataset'); 166 dcl num --- 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 167 dset; ====================================== ====================================== ===================================== EG CODE 1 ;*';*";*/;quit;run; 2 OPTIONS PAGENO=MIN; 3 %LET _CLIENTTASKLABEL=%NRBQUOTE(Code For Bar Chart); 4 %LET _EGTASKLABEL=%NRBQUOTE(Code For Bar Chart); 5 %LET _CLIENTPROJECTNAME=%NRBQUOTE(\\usto-home\rdeangel\utl \Project.egp); 6 %LET _SASPROGRAMFILE=; 7 8 ODS _ALL_ CLOSE; 9 OPTIONS DEV=SASEMF; 10 FILENAME EGHTML TEMP; NOTE: Writing HTML(EGHTML) Body file: EGHTML 11 ODS HTML(ID=EGHTML) FILE=EGHTML ENCODING='utf-8' STYLE=EGDefault 11 ! STYLESHEET=(URL="file:///C:/Program%20Files/SAS/Shared %20Files/BIClientStyles/EGDefault.css") NOGTITLE NOGFOOTNOTE 11 ! GPATH=&sasworklocation; 12 13 %gaccessible; ERROR 180-322: Statement is not valid or it is used out of proper order. 14 15 startup2: method / (description='results ______ 180 16 dataset'); On Feb 26, 11:29 pm, kuh...(a)126.COM (Clark An) wrote: > Very interesting.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Problem with the "contents" option in tagsets.excelxp Next: PROC EXPORT in SAS/Server |