Hi,
We're converting material from Enterprise Miner over to Viya Model Studio. We have a custom SAS code node that reads information from a preceding Interactive Grouping node, to get the group labels for the groups created by the IG node.
To get this info in Miner, we use a table called something like ign_stats. I know this exists at least temporarily in Viya but I can't access it in code. Any ideas how I might find it?
In Miner we used the code below.
Many thanks,
Tom.
%EM_PATH (nodeid=&em_nodeid. , outds=all_nodes , nodes=PATH);
data ign_node;
set all_nodes (where=(component="IGN"));
run;
data ign_node;
set ign_node;
by component;
if last.component;
run;
proc sql;
select nodelabel into :ign_nodeid from ign_node;
quit;
proc print data=&em_lib..%sysfunc(cats(%CMPRES(&ign_nodeid.),_stats));
run;
/* SAS code */
/* Retrieve the id of the last Interactive Grouping node */
%let cs_guid=;
data _null_;
set &dm_predecessors end=eof;
where component='cs_ign';
if eof then call symputx('cs_guid', guid);
run;
data _null_;
folder = dcreate(strip(symget('cs_guid')), "&dmcas_workpath"); /* Create a folder to put all the files registered */
run;
/* Fetch all registered files under that node */
%dmcas_fetchRegistered(&cs_guid, &dmcas_workpath.&dm_dsep.&cs_guid);
/* Fetch from the dmcas_report table on the data sets */
libname cslib "&dmcas_workpath.&dm_dsep.&cs_guid";
data work.reportTables;
set cslib.dmcas_report;
where upcase(name) in('DATASET', 'FILE');
run;
proc sort data=work.reportTables NODUPKEY;
by VALUE;
run;
/* view the registered files for the node */
proc print data=work.reportTables;
run;
/* this is ign_stats data set */
proc print data=cslib.ign_stats;
run;
libname cslib;
Hi Tom - this code might be a bit of overkill since you know the data set that you want to access, but this should get you what you want I think.
Hope that helps!
/* SAS code */
/* Retrieve the id of the last Interactive Grouping node */
%let cs_guid=;
data _null_;
set &dm_predecessors end=eof;
where component='cs_ign';
if eof then call symputx('cs_guid', guid);
run;
data _null_;
folder = dcreate(strip(symget('cs_guid')), "&dmcas_workpath"); /* Create a folder to put all the files registered */
run;
/* Fetch all registered files under that node */
%dmcas_fetchRegistered(&cs_guid, &dmcas_workpath.&dm_dsep.&cs_guid);
/* Fetch from the dmcas_report table on the data sets */
libname cslib "&dmcas_workpath.&dm_dsep.&cs_guid";
data work.reportTables;
set cslib.dmcas_report;
where upcase(name) in('DATASET', 'FILE');
run;
proc sort data=work.reportTables NODUPKEY;
by VALUE;
run;
/* view the registered files for the node */
proc print data=work.reportTables;
run;
/* this is ign_stats data set */
proc print data=cslib.ign_stats;
run;
libname cslib;
Hi Tom - this code might be a bit of overkill since you know the data set that you want to access, but this should get you what you want I think.
Hope that helps!
Since this question has come up before, this prompted me to add some example code to our GitHub repo: https://github.com/sassoftware/sas-viya-dmml-pipelines/tree/master/sas_code_node/access_data_from_pr...
Tom, you can use the use_data_from_predecessor.sas one since you know the name of your data set is ign_stats, so just substitute that for xyz.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.