Hello, I have SAS code note:
PROC SQL;
SELECT quote(MATERIAL) into: List separated by ',' FROM EMWS3.FILTER_TRAIN;
CREATE TABLE TABLELIST AS
SELECT T2.BAT_NUM,
T2.MAT_COD,
T2.UNRESTRICTED_QTY
FROM GDM_DIST.VW_MERPS_STOCKINV_INFO T2
WHERE T2.MAT_COD IN (&List);
SELECT * FROM TABLELIST;
/*INSERT INTO &EM_EXPORT_TRAIN
SELECT * FROM &TABLELIST;*/
QUIT;
I want to the TABLELIST be &EM_EXPORT_TRAIN that will be imported node input for following node. Since &EM_EXPORT_TRAIN; is created already, I tried delete and into, both methods dont work due to &EM_EXPORT_TRAIN is of 'read only'
Could you please suggest any method can put the results to &EM_EXPORT_TRAIN (exported data table of THIS SAS code Node).
Many thanks
@Jonison wrote:
I want to the TABLELIST be &EM_EXPORT_TRAIN that will be imported node input for following node. Since &EM_EXPORT_TRAIN; is created already, I tried delete and into, both methods dont work due to &EM_EXPORT_TRAIN is of 'read only'
I'm really not understanding this. Please explain further.
&EM_EXPORT_TRAIN is macro of export training dataset 'SAS Code Node'. To my understanding, in SAS miner, the export training dataset will inherit the whole import training dataset.
This 'SAS Code Node' aims selecting a sub-group of import training dataset (saved as TABLELIST), and save this to &EM_EXPORT_TRAIN which can be used as the input for the following nodes.
I tried use 'delete' function to remove the &EM_EXPORT_TRAIN table, it failed since it is read-only.
and failed too with 'update' and/or 'into' functions (update &EM_EXPORT_TRAIN content) with the same reason.
Just would like to know is there anyway to save TABLELIST content to &EM_EXPORT_TRAIN.
Thanks
@Jonison wrote:
&EM_EXPORT_TRAIN is macro of export training dataset 'SAS Code Node'. To my understanding, in SAS miner, the export training dataset will inherit the whole import training dataset.
This 'SAS Code Node' aims selecting a sub-group of import training dataset (saved as TABLELIST), and save this to &EM_EXPORT_TRAIN which can be used as the input for the following nodes.
I tried use 'delete' function to remove the &EM_EXPORT_TRAIN table, it failed since it is read-only.
and failed too with 'update' and/or 'into' functions (update &EM_EXPORT_TRAIN content) with the same reason.
Just would like to know is there anyway to save TABLELIST content to &EM_EXPORT_TRAIN.
Thanks
I know nothing about SAS minor. But EM_EXPORT_TRAIN is a macro variable. You are saying it contains the name of a dataset.
If you want it to point to a different data set then then change the value of the macro variable instead of trying to change the dataset that it is currently pointing to. So try something like this:
%let em_export_train=My_Other_Dataset;
ERROR: Expecting a variable name after %LET.
7798 %let &EM_DATA_EXPORTSET=TABLELIST;
You told %LET to use the value of EM_DATE_EXPORTSET as the NAME of the macro variable you wanted to create.
If you want to change the value of the macro variable EM_DATE_EXPORTSET then don't put the & in front of it in the %LET statement.
%let EM_DATA_EXPORTSET=TABLELIST;
Can you provide the exact ERROR message you are getting?
If the problem is really that the data set is write-only, then there's really nothing in SAS that can change this and you can't overwrite or modify this data set. You need to contact your IT department, or otherwise find a way to change the permissions on this data set.
Note for clarity and proper use of terminology:
&EM_EXPORT_TRAIN is macro of export training dataset 'SAS Code Node'
&EM_EXPORT_TRAIN is not a macro. It is a macro variable. Do not confuse these two things.
@JonisonNot sure if I understood exactly what you want but you may try the code below. I have divided one SQL step into two.
PROC SQL;
SELECT quote(MATERIAL) INTO: List separated by ',' FROM EMWS3.FILTER_TRAIN;
QUIT;
PROC SQL;
CREATE TABLE TABLELIST AS SELECT T2.BAT_NUM, T2.MAT_COD, T2.UNRESTRICTED_QTY
FROM GDM_DIST.VW_MERPS_STOCKINV_INFO T2 WHERE T2.MAT_COD IN (&List);
SELECT * FROM TABLELIST;
/*INSERT INTO &EM_EXPORT_TRAIN
SELECT * FROM &TABLELIST;*/
QUIT;
I am sorry if this is not what you wanted.
Many thanks for your kind reply.
I would like to save the TABLELIST in &EM_EXPORT_TRAIN
&EM_EXPORT_TRAIN is macro of output training dataset of this node.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.