<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to add temporary fields in my code that doesn't exists in my dataset currently . in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-temporary-fields-in-my-code-that-doesn-t-exists-in-my/m-p/735211#M229035</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;...&amp;nbsp;&lt;SPAN&gt;how can I create a field which doesn't actually exists in the current dataset but exported in my outfile&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any variable you want to export via PROC EXPORT must be contained in the data set you are exporting. If you don't want those variables in data set ALL_PORT_CIPCRU, don't put them in there. Put those variables in a different data set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data all_port_cipcru_temp;
set thd_cipcru;
CRS_CIP_NAM_VER_DTE1=input(CRS_CIP_NAM_VER_DTE, mmddyy8.);
CRS_CIP_DOB_VER_DTE1=input(CRS_CIP_DOB_VER_DTE, mmddyy8.);
CRS_CIP_ADR_VER_DTE1=input(CRS_CIP_ADR_VER_DTE, mmddyy8.);
CRS_CIP_SSNT_VER_DTE1=input(CRS_CIP_SSNT_VER_DTE, mmddyy8.);
format CRS_CIP_NAM_VER_DTE1 mmddyyd10. CRS_CIP_DOB_VER_DTE1 mmddyyd10. CRS_CIP_ADR_VER_DTE1 mmddyyd10. CRS_CIP_SSNT_VER_DTE1 mmddyyd10.;
drop CRS_CIP_NAM_VER_DTE CRS_CIP_DOB_VER_DTE CRS_CIP_ADR_VER_DTE CRS_CIP_SSNT_VER_DTE;
rename CRS_CIP_NAM_VER_DTE1=CRS_CIP_NAM_VER_DTE;
rename CRS_CIP_DOB_VER_DTE1=CRS_CIP_DOB_VER_DTE;
rename CRS_CIP_ADR_VER_DTE1=CRS_CIP_ADR_VER_DTE;
rename CRS_CIP_SSNT_VER_DTE1=CRS_CIP_SSNT_VER_DTE;
run;

proc export data =all_port_cipcru_temp
outfile="/etl/home/rrtqarun/data/aml/Datasets/cardholder/dataset_frequency/cda_can_rpl_cipcrussn_&amp;amp;DT2..csv"
dbms=csv
replace;
delimiter= '|';
run;

proc delete data=all_port_cipcru temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Apr 2021 10:58:30 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-04-19T10:58:30Z</dc:date>
    <item>
      <title>How to add temporary fields in my code that doesn't exists in my dataset currently .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-temporary-fields-in-my-code-that-doesn-t-exists-in-my/m-p/735182#M229026</link>
      <description>&lt;P&gt;Hi Guys !!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Objective&lt;/STRONG&gt; : I want to add a dummy field (BO_EXEMPTION_IND) that doesn't exists in my current dataset . But I want that to come as a field in my exported file/Outfile ( CSV file ) as before the code drop I want to perform my internal testing .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is the piece of code where in KEEP=OPTION I am mentioning all my fields which I want.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro c;
(KEEP =CRS_ACCT_NBR CRS_CUSTOMER_TYPE CRS_APPLICATION_ID
CRS_CIP_SSN_TAX_ID CRS_CIP_SSNT_VE_SRC_CD CRS_CIP_CONFIRMATI_CD
CRS_AGENT_NOTES_DAT CRS_APPL_SSN_TAX_ID CRS_GOV_TYPE_ID &lt;STRONG&gt;BO_EXEMPTION_IND&lt;/STRONG&gt;)
%mend;

data thd_cipcru;
set thd.cipcrussn&amp;amp;DT.;
run;

data all_port_cipcru;
set thd_cipcru;
CRS_CIP_NAM_VER_DTE1=input(CRS_CIP_NAM_VER_DTE, mmddyy8.);
CRS_CIP_DOB_VER_DTE1=input(CRS_CIP_DOB_VER_DTE, mmddyy8.);
CRS_CIP_ADR_VER_DTE1=input(CRS_CIP_ADR_VER_DTE, mmddyy8.);
CRS_CIP_SSNT_VER_DTE1=input(CRS_CIP_SSNT_VER_DTE, mmddyy8.);
format CRS_CIP_NAM_VER_DTE1 mmddyyd10. CRS_CIP_DOB_VER_DTE1 mmddyyd10. CRS_CIP_ADR_VER_DTE1 mmddyyd10. CRS_CIP_SSNT_VER_DTE1 mmddyyd10.;
drop CRS_CIP_NAM_VER_DTE CRS_CIP_DOB_VER_DTE CRS_CIP_ADR_VER_DTE CRS_CIP_SSNT_VER_DTE;
rename CRS_CIP_NAM_VER_DTE1=CRS_CIP_NAM_VER_DTE;
rename CRS_CIP_DOB_VER_DTE1=CRS_CIP_DOB_VER_DTE;
rename CRS_CIP_ADR_VER_DTE1=CRS_CIP_ADR_VER_DTE;
rename CRS_CIP_SSNT_VER_DTE1=CRS_CIP_SSNT_VER_DTE;

run;

proc sort data =all_port_cipcru nodupkey;
by _all_;
run;

data all_port_cipcru;
retain CRS_ACCT_NBR CRS_CUSTOMER_TYPE CRS_APPLICATION_ID
CRS_CIP_SSN_TAX_ID CRS_CIP_SSNT_VE_SRC_CD CRS_CIP_CONFIRMATI_CD
CRS_AGENT_NOTES_DAT CRS_APPL_SSN_TAX_ID CRS_GOV_TYPE_ID &lt;STRONG&gt;BO_EXEMPTION_IND&lt;/STRONG&gt;;
set all_port_cipcru %c;
run;

proc export data =all_port_cipcru
outfile="/etl/home/rrtqarun/data/aml/Datasets/cardholder/dataset_frequency/cda_can_rpl_cipcrussn_&amp;amp;DT2..csv"
dbms=csv
replace;
delimiter= '|';
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can you guys please help me ?? that how can I create a field which doesn't actually exists in the current dataset but exported in my outfile.&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 19 Apr 2021 07:34:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-temporary-fields-in-my-code-that-doesn-t-exists-in-my/m-p/735182#M229026</guid>
      <dc:creator>librasonali</dc:creator>
      <dc:date>2021-04-19T07:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to add temporary fields in my code that doesn't exists in my dataset currently .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-temporary-fields-in-my-code-that-doesn-t-exists-in-my/m-p/735211#M229035</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;...&amp;nbsp;&lt;SPAN&gt;how can I create a field which doesn't actually exists in the current dataset but exported in my outfile&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any variable you want to export via PROC EXPORT must be contained in the data set you are exporting. If you don't want those variables in data set ALL_PORT_CIPCRU, don't put them in there. Put those variables in a different data set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data all_port_cipcru_temp;
set thd_cipcru;
CRS_CIP_NAM_VER_DTE1=input(CRS_CIP_NAM_VER_DTE, mmddyy8.);
CRS_CIP_DOB_VER_DTE1=input(CRS_CIP_DOB_VER_DTE, mmddyy8.);
CRS_CIP_ADR_VER_DTE1=input(CRS_CIP_ADR_VER_DTE, mmddyy8.);
CRS_CIP_SSNT_VER_DTE1=input(CRS_CIP_SSNT_VER_DTE, mmddyy8.);
format CRS_CIP_NAM_VER_DTE1 mmddyyd10. CRS_CIP_DOB_VER_DTE1 mmddyyd10. CRS_CIP_ADR_VER_DTE1 mmddyyd10. CRS_CIP_SSNT_VER_DTE1 mmddyyd10.;
drop CRS_CIP_NAM_VER_DTE CRS_CIP_DOB_VER_DTE CRS_CIP_ADR_VER_DTE CRS_CIP_SSNT_VER_DTE;
rename CRS_CIP_NAM_VER_DTE1=CRS_CIP_NAM_VER_DTE;
rename CRS_CIP_DOB_VER_DTE1=CRS_CIP_DOB_VER_DTE;
rename CRS_CIP_ADR_VER_DTE1=CRS_CIP_ADR_VER_DTE;
rename CRS_CIP_SSNT_VER_DTE1=CRS_CIP_SSNT_VER_DTE;
run;

proc export data =all_port_cipcru_temp
outfile="/etl/home/rrtqarun/data/aml/Datasets/cardholder/dataset_frequency/cda_can_rpl_cipcrussn_&amp;amp;DT2..csv"
dbms=csv
replace;
delimiter= '|';
run;

proc delete data=all_port_cipcru temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 10:58:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-temporary-fields-in-my-code-that-doesn-t-exists-in-my/m-p/735211#M229035</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-19T10:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to add temporary fields in my code that doesn't exists in my dataset currently .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-temporary-fields-in-my-code-that-doesn-t-exists-in-my/m-p/735281#M229052</link>
      <description>&lt;P&gt;You can also use data set options Drop or Keep in any procedure to limit the variables used by the procedure.&lt;/P&gt;
&lt;P&gt;So with your shown code the macro C could be used to provide the Keep statement as data set option for proc export if that is the intent.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc export data =all_port_cipcru &lt;FONT size="5" color="#0000FF"&gt;&lt;STRONG&gt;%c&lt;/STRONG&gt;&lt;/FONT&gt;
outfile="/etl/home/rrtqarun/data/aml/Datasets/cardholder/dataset_frequency/cda_can_rpl_cipcrussn_&amp;amp;DT2..csv"
dbms=csv
replace;
delimiter= '|';
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Apr 2021 14:58:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-temporary-fields-in-my-code-that-doesn-t-exists-in-my/m-p/735281#M229052</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-19T14:58:23Z</dc:date>
    </item>
  </channel>
</rss>

