I've tried to run a code to create start and stop lists for further analysis, but my SAS code node does not seem to get the macro variables. Even though it shows that the EM_IMPORT_DATA_EMINFO variable has a value. /*---- SCN_CreateStartStopList_AW.sas -----------------*/
/*---- Create Start List using frequency filtering ----*/
%global LastParsing LastFilter TermData FTermData
StartList MaxDocs MinDocs;
/*!!!! Edit the following 5 lines !!!!*/
%let StartList=AWstart;
%let StopList=AWstop;
%let MaxDocs=2000;
%let MinDocs=10;
%let AllowNumbers=N;
%let LastParsing= ;
%let LastFilter= ;
proc print data= &EM_IMPORT_DATA_EMINFO;
run;
proc sql noprint;
select data into :LastFilter
from &EM_IMPORT_DATA_EMINFO
where key="LastTextFilter";
select data into :LastParsing
from &EM_IMPORT_DATA_EMINFO
where key="LastTextParsing";
quit;
%put NOTE: Last SAS Text Parsing Node: &LastParsing;
%put NOTE: Last Text Filter Node: &LastFilter;
%let TermData=%sysfunc(strip(&EM_LIB)).%sysfunc(strip(&LastParsing))_terms;
%let FTermData=%sysfunc(strip(&EM_LIB)).%sysfunc(strip(&LastFilter))_terms_data;
%EM_REGISTER(KEY=TERMS,TYPE=DATA);
%EM_REPORT(KEY=TERMS,VIEWTYPE=DATA);
%EM_REGISTER(KEY=TERMTRANS,TYPE=DATA);
%EM_REPORT(KEY=TERMS,VIEWTYPE=DATA);
%macro GetData();
%if %sysfunc(exist(&TermData)) & %sysfunc(exist(&FTermData)) %then %do;
%EM_REPORT(KEY=TERMS,VIEWTYPE=DATA,AUTODISPLAY=Y);
data &EM_USER_TERMS;
set &TermData;
run;
proc contents data=&EM_USER_TERMS;
run;
%EM_REPORT(KEY=TERMTRANS,VIEWTYPE=DATA,AUTODISPLAY=Y);
data &EM_USER_TERMTRANS;
set &FTermData(where=(Keep='Y' and &MinDocs<=NumDocs<=&MaxDocs));
run;
proc contents data=&EM_USER_TERMTRANS;
run;
proc univariate data=&EM_USER_TERMTRANS;
var NumDocs Weight;
run;
proc sql;
create table &StartList as
select a.KEY, a.Role, a.TERM, b.Weight
from &EM_USER_TERMS a, &EM_USER_TERMTRANS b
where a.KEY=b.KEY and
b.Weight>0;
quit;
%if (&AllowNumbers ne Y) %then %do;
data &StartList;
set &StartList;
if ('0'<=substr(TERM,1,1)<='9') then delete;
run;
%end;
proc sql;
create table &StopList as
select a.Term, a.Role
from &TermData a, &EM_USER_TERMTRANS b
where a.KEY=b.KEY and
a.KEY not in
(select c.KEY from &StartList c);
quit;
data &StartList;
set &StartList;
drop KEY;
run;
proc sort data=&StartList nodupkey;
by Term Role;
run;
proc contents data=&StartList;
run;
proc sort data=&StopList nodupkey;
by Term Role;
run;
proc contents data=&StopList;
run;
%end;
%mend GetData;
%GetData(); LOG: 50 The SAS System Tuesday, 19 April 2022 10:50:0 0 57534 %let SYSCC=0; 57535 %let SYsrc=0; 57536 %let EMEXCEPTIONSTRING=; 57537 %let SYSMSG=; 57538 filename _temp catalog "sashelp.emutil.em_loadmacros.source"; 57539 %inc _temp; NOTE: %INCLUDE (level 1) file _TEMP is file SASHELP.EMUTIL.EM_LOADMACROS.SOURCE. 57540 +%macro em_loadmacros(emlib=, nodeid=, vars=Y, ign=); 57541 + %global em_lib em_nodeid em_vars em_loadign; 57542 + %let em_lib = %upcase(&emlib); 57543 + %let em_nodeid = &nodeid; 57544 + %let em_vars = &vars; 57545 + %let em_loadign = &ign; 57546 + proc display c=sashelp.emutil.loadmacros.scl; 57547 + run; 57548 + quit; 57549 +%mend em_loadmacros; NOTE: %INCLUDE (level 1) ending. 57550 filename _temp; NOTE: Fileref _TEMP has been deassigned. 57551 filename _temp catalog 'sashelp.emutil.em_refreshexport.source'; 57552 %inc _temp; NOTE: %INCLUDE (level 1) file _TEMP is file SASHELP.EMUTIL.EM_REFRESHEXPORT.SOURCE. 57553 +%macro em_refreshExport(emlib=, nodeid=); 57554 + %global em_lib em_nodeid; 57555 + %let em_lib = %upcase(&emlib); 57556 + %let em_nodeid = &nodeid; 57557 + proc display c=sashelp.emutil.refreshexport.scl; 57558 + run; 57559 + quit; 57560 +%mend em_refreshExport; NOTE: %INCLUDE (level 1) ending. 57561 filename _temp; NOTE: Fileref _TEMP has been deassigned. 57562 %em_loadmacros(emlib=EMWS1, nodeid=EMCODE);/*---- SCN_CreateStartStopList_AW.sas -----------------*/ NOTE: PROCEDURE DISPLAY used (Total process time): real time 0.32 seconds user cpu time 0.27 seconds system cpu time 0.07 seconds memory 2455.50k OS Memory 63912.00k Timestamp 19/04/2022 11:28:56 AM Step Count 114 Switch Count 3 Page Faults 0 Page Reclaims 6809 Page Swaps 0 Voluntary Context Switches 1390 Involuntary Context Switches 3 Block Input Operations 0 Block Output Operations 2120 61962 /*---- Create Start List using frequency filtering ----*/ 61963 61964 %global LastParsing LastFilter TermData FTermData 61965 StartList MaxDocs MinDocs; 61966 61967 /*!!!! Edit the following 5 lines !!!!*/ 61968 %let StartList=AWstart; 61969 %let StopList=AWstop; 61970 %let MaxDocs=2000; 61971 %let MinDocs=10; 61972 %let AllowNumbers=N; 61973 61974 %let LastParsing= ; 61975 %let LastFilter= ; 61976 61977 proc print data= &EM_IMPORT_DATA_EMINFO; _ 22 200 WARNING: Apparent symbolic reference EM_IMPORT_DATA_EMINFO not resolved. ERROR: File WORK.EM_IMPORT_DATA_EMINFO.DATA does not exist. ERROR 22-322: Expecting a name. ERROR 200-322: The symbol is not recognized and will be ignored. 61978 run; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE PRINT used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 74.43k OS Memory 62876.00k Timestamp 19/04/2022 11:28:56 AM Step Count 115 Switch Count 0 Page Faults 0 Page Reclaims 16 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 0 61979 61980 proc sql noprint; 61981 select data into :LastFilter 61982 from &EM_IMPORT_DATA_EMINFO WARNING: Apparent symbolic reference EM_IMPORT_DATA_EMINFO not resolved. 61982 from &EM_IMPORT_DATA_EMINFO _ 22 ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, CONNECTION, DICTIONARY. 61982 from &EM_IMPORT_DATA_EMINFO _ 200 ERROR 200-322: The symbol is not recognized and will be ignored. 61983 where key="LastTextFilter"; NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements. 61984 select data into :LastParsing 61985 from &EM_IMPORT_DATA_EMINFO WARNING: Apparent symbolic reference EM_IMPORT_DATA_EMINFO not resolved. 61985 from &EM_IMPORT_DATA_EMINFO _ 22 ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, CONNECTION, DICTIONARY. 61985 from &EM_IMPORT_DATA_EMINFO _ 200 ERROR 200-322: The symbol is not recognized and will be ignored. 61986 where key="LastTextParsing"; 61987 quit; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE SQL used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 49.34k OS Memory 62876.00k Timestamp 19/04/2022 11:28:56 AM Step Count 116 Switch Count 0 Page Faults 0 Page Reclaims 14 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 8 61988 61989 %put NOTE: Last SAS Text Parsing Node: &LastParsing; NOTE: Last SAS Text Parsing Node: 61990 %put NOTE: Last Text Filter Node: &LastFilter; NOTE: Last Text Filter Node: 61991 61992 %let TermData=%sysfunc(strip(&EM_LIB)).%sysfunc(strip(&LastParsing))_terms; ERROR: The function STRIP referenced by the %SYSFUNC or %QSYSFUNC macro function has too few arguments. 61993 %let FTermData=%sysfunc(strip(&EM_LIB)).%sysfunc(strip(&LastFilter))_terms_data; ERROR: The function STRIP referenced by the %SYSFUNC or %QSYSFUNC macro function has too few arguments. 61994 61995 %EM_REGISTER(KEY=TERMS,TYPE=DATA); NOTE: There were 6 observations read from the data set WORK.EM_USER_KEY. NOTE: The data set WORK.EM_USER_KEY has 7 observations and 9 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 818.93k OS Memory 63396.00k Timestamp 19/04/2022 11:28:56 AM Step Count 117 Switch Count 2 Page Faults 0 Page Reclaims 130 Page Swaps 0 Voluntary Context Switches 9 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 264 61996 %EM_REPORT(KEY=TERMS,VIEWTYPE=DATA); NOTE: There were 792 observations read from the data set WORK.EM_USER_REPORT. NOTE: The data set WORK.EM_USER_REPORT has 924 observations and 4 variables. NOTE: DATA statement used (Total process time): real time 0.02 seconds user cpu time 0.03 seconds system cpu time 0.00 seconds memory 1869.81k OS Memory 64932.00k Timestamp 19/04/2022 11:28:56 AM Step Count 118 Switch Count 2 Page Faults 0 Page Reclaims 392 Page Swaps 0 Voluntary Context Switches 9 Involuntary Context Switches 1 Block Input Operations 0 Block Output Operations 1032 61997 %EM_REGISTER(KEY=TERMTRANS,TYPE=DATA); NOTE: There were 7 observations read from the data set WORK.EM_USER_KEY. NOTE: The data set WORK.EM_USER_KEY has 8 observations and 9 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 819.03k OS Memory 63396.00k Timestamp 19/04/2022 11:28:56 AM Step Count 119 Switch Count 2 Page Faults 0 Page Reclaims 123 Page Swaps 0 Voluntary Context Switches 9 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 264 61998 %EM_REPORT(KEY=TERMS,VIEWTYPE=DATA); NOTE: There were 924 observations read from the data set WORK.EM_USER_REPORT. NOTE: The data set WORK.EM_USER_REPORT has 1056 observations and 4 variables. NOTE: DATA statement used (Total process time): real time 0.02 seconds user cpu time 0.02 seconds system cpu time 0.00 seconds memory 1997.81k OS Memory 65060.00k Timestamp 19/04/2022 11:28:56 AM Step Count 120 Switch Count 2 Page Faults 0 Page Reclaims 407 Page Swaps 0 Voluntary Context Switches 9 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 1032 61999 62000 %macro GetData(); 62001 %if %sysfunc(exist(&TermData)) & %sysfunc(exist(&FTermData)) %then %do; 62002 %EM_REPORT(KEY=TERMS,VIEWTYPE=DATA,AUTODISPLAY=Y); 62003 data &EM_USER_TERMS; 62004 set &TermData; 62005 run; 62006 proc contents data=&EM_USER_TERMS; 62007 run; 62008 62009 %EM_REPORT(KEY=TERMTRANS,VIEWTYPE=DATA,AUTODISPLAY=Y); 62010 data &EM_USER_TERMTRANS; 62011 set &FTermData(where=(Keep='Y' and &MinDocs<=NumDocs<=&MaxDocs)); 62012 run; 62013 proc contents data=&EM_USER_TERMTRANS; 62014 run; 62015 proc univariate data=&EM_USER_TERMTRANS; 62016 var NumDocs Weight; 62017 run; 62018 62019 proc sql; 62020 create table &StartList as 62021 select a.KEY, a.Role, a.TERM, b.Weight 62022 from &EM_USER_TERMS a, &EM_USER_TERMTRANS b 62023 where a.KEY=b.KEY and 62024 b.Weight>0; 62025 quit; 62026 %if (&AllowNumbers ne Y) %then %do; 62027 data &StartList; 62028 set &StartList; 62029 if ('0'<=substr(TERM,1,1)<='9') then delete; 62030 run; 62031 %end; 62032 proc sql; 62033 create table &StopList as 62034 select a.Term, a.Role 62035 from &TermData a, &EM_USER_TERMTRANS b 62036 where a.KEY=b.KEY and 62037 a.KEY not in 62038 (select c.KEY from &StartList c); 62039 quit; 62040 data &StartList; 62041 set &StartList; 62042 drop KEY; 62043 run; 62044 proc sort data=&StartList nodupkey; 62045 by Term Role; 62046 run; 62047 proc contents data=&StartList; 62048 run; 62049 proc sort data=&StopList nodupkey; 62050 by Term Role; 62051 run; 62052 proc contents data=&StopList; 62053 run; 62054 %end; 62055 %mend GetData; 62056 62057 %GetData(); 62058 62059 /*; *"; *'; */;
... View more