<?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: SAS Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546262#M151223</link>
    <description>&lt;P&gt;Linux.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Mar 2019 18:35:45 GMT</pubDate>
    <dc:creator>mauri0623</dc:creator>
    <dc:date>2019-03-26T18:35:45Z</dc:date>
    <item>
      <title>SAS Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546255#M151220</link>
      <description>&lt;P&gt;I need help with creating a macro that can loop through six different .DAT files and make six SAS dataset from them. Below is the code.&lt;/P&gt;&lt;P&gt;MCD-0190-201812-001.DAT&lt;BR /&gt;MCD-0191-201812-001.DAT&lt;BR /&gt;MCD-0192-201812-001.DAT&lt;BR /&gt;MCD-0193-201812-001.DAT&lt;BR /&gt;MCD-0194-201812-001.DAT&lt;BR /&gt;MCD-0198-201812-001.DAT&lt;/P&gt;&lt;P&gt;I have the above six files that I want to make a SAS dataset from them. Not one at a time but all of then in one macro.How do I build this macro that&lt;BR /&gt;can read one file at a time and make a SAS dataset out of them?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Data MCD;&lt;/P&gt;&lt;P&gt;infile "&amp;amp;filename." truncover firstobs=2 END=EOF LRECl=564 missover;&lt;/P&gt;&lt;P&gt;LENGTH ENCTR_TYP_CD /*sequence*/ DRG_CD $3.&lt;BR /&gt;MAJ_SPCL_CD INST_TYP_CD $2. ;&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;FORMAT sbmt_rec_idx_nbr z11. sequence 8.&lt;BR /&gt;COST 11.2 COPAY 7.2 DW_LD_RUN_ID DW_UPDT_RUN_ID 8.&lt;BR /&gt;REL_ADMIS_DT REL_DISP_DT&lt;BR /&gt;DW_SYS_EFF_DT DW_SYS_END_DT&lt;BR /&gt;SRVC_1_START_DT SRVC_1_END_DT&lt;BR /&gt;SRVC_2_START_DT SRVC_2_END_DT&lt;BR /&gt;SRVC_3_START_DT SRVC_3_END_DT&lt;BR /&gt;SRVC_4_START_DT SRVC_4_END_DT&lt;BR /&gt;SRVC_5_START_DT SRVC_5_END_DT&lt;BR /&gt;SRVC_6_START_DT SRVC_6_END_DT&lt;BR /&gt;HOSP_SRV_ADMIS_DT HOSP_SRV_DISP_DT yymmddn8. ;&lt;/P&gt;&lt;P&gt;INPUT &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159673"&gt;@001&lt;/a&gt; DMIS_ID $4.&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159673"&gt;@001&lt;/a&gt; DMIS_ID_2 $4. /* added 9-16-08 by hjohnson */&lt;BR /&gt;@005 DEERS_FAM_ID $9.&lt;BR /&gt;@014 DEERS_BEN_ID $2.&lt;BR /&gt;@016 PTNT_ID $10.&lt;BR /&gt;@026 PTNT_LST_NM $27.&lt;BR /&gt;@053 PTNT_FST_NM $20.&lt;BR /&gt;@073 SPSR_SSN $9.&lt;BR /&gt;@082 UNIQ_PTNT_REF_NBR $12.&lt;BR /&gt;@094 ENCTR_SETTING_CD $1.&lt;BR /&gt;@095 DIAG_1 $7.&lt;BR /&gt;@102 DIAG_2 $7.&lt;BR /&gt;@109 DIAG_3 $7.&lt;BR /&gt;@116 DIAG_4 $7.&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/9435"&gt;@123&lt;/a&gt; DIAG_5 $7.&lt;BR /&gt;@130 DIAG_6 $7.&lt;BR /&gt;@137 DIAG_7 $7.&lt;BR /&gt;@144 DIAG_8 $7.&lt;BR /&gt;@151 DIAG_9 $7.&lt;BR /&gt;@158 DIAG_10 $7.&lt;BR /&gt;@165 DIAG_11 $7.&lt;BR /&gt;@172 DIAG_12 $7.&lt;BR /&gt;@179 UNIQ_PROV_ID $18.&lt;BR /&gt;@ ;&lt;BR /&gt;if ENCTR_SETTING_CD in ('I','O') then do ;&lt;BR /&gt;input @197 MAJ_SPCL_CD $2. @ ;&lt;BR /&gt;end ;&lt;BR /&gt;else do ;&lt;BR /&gt;input @197 INST_TYP_CD $2. @ ;&lt;BR /&gt;end ;&lt;BR /&gt;output ENCTR_SETTING_CD;&lt;/P&gt;&lt;P&gt;INPUT @199 ORDR_UNIQ_PROV_ID $18.&lt;BR /&gt;@217 COST_char $11.&lt;BR /&gt;@217 COST 11.2&lt;BR /&gt;@228 COPAY_char $6.&lt;BR /&gt;@228 COPAY 6.2&lt;BR /&gt;@234 EMRG_FLG_IND $1.&lt;BR /&gt;@235 REL_ADMIS_DT_char $8. @ ;&lt;BR /&gt;if REL_ADMIS_DT_char in ('00000000',' ') then REL_ADMIS_DT = '31dec9999'd ;&lt;BR /&gt;else do ;&lt;BR /&gt;input @235 REL_ADMIS_DT yymmdd8. @ ;&lt;BR /&gt;end ;&lt;BR /&gt;output REL_ADMIS_DT;&lt;/P&gt;&lt;P&gt;INPUT @243 REL_DISP_DT_char $8. @ ;&lt;BR /&gt;if REL_DISP_DT_char in ('00000000',' ') then REL_DISP_DT = '31dec9999'd ;&lt;BR /&gt;else do ;&lt;BR /&gt;input @243 REL_DISP_DT yymmdd8. @ ;&lt;BR /&gt;end ;&lt;BR /&gt;output REL_DISP_DT;&lt;/P&gt;&lt;P&gt;INPUT &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/115114"&gt;@251&lt;/a&gt; NBR_OF_SRVCS $1.&lt;BR /&gt;@252 SRVC_1_START_DT yymmdd8.&lt;BR /&gt;@260 SRVC_1_END_DT yymmdd8.&lt;BR /&gt;@268 SRVC_1_PL_OF_SRVC $2.&lt;BR /&gt;@270 SRVC_1_PROC_CD $7.&lt;BR /&gt;@283 SRVC_1_REL_DIAG_CD $7.&lt;BR /&gt;@290 SRVC_1_QTY $3.&lt;BR /&gt;@293 SRVC_2_START_DT yymmdd8.&lt;BR /&gt;@301 SRVC_2_END_DT yymmdd8.&lt;BR /&gt;@309 SRVC_2_PL_OF_SRVC $2.&lt;BR /&gt;@311 SRVC_2_PROC_CD $7.&lt;BR /&gt;@324 SRVC_2_REL_DIAG_CD $7.&lt;BR /&gt;@331 SRVC_2_QTY $3.&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/108495"&gt;@334&lt;/a&gt; SRVC_3_START_DT yymmdd8.&lt;BR /&gt;@342 SRVC_3_END_DT yymmdd8.&lt;BR /&gt;@350 SRVC_3_PL_OF_SRVC $2.&lt;BR /&gt;@352 SRVC_3_PROC_CD $7.&lt;BR /&gt;@365 SRVC_3_REL_DIAG_CD $7.&lt;BR /&gt;@372 SRVC_3_QTY $3.&lt;BR /&gt;@375 SRVC_4_START_DT yymmdd8.&lt;BR /&gt;@383 SRVC_4_END_DT yymmdd8.&lt;BR /&gt;@391 SRVC_4_PL_OF_SRVC $2.&lt;BR /&gt;@393 SRVC_4_PROC_CD $7.&lt;BR /&gt;@406 SRVC_4_REL_DIAG_CD $7.&lt;BR /&gt;@413 SRVC_4_QTY $3.&lt;BR /&gt;@416 SRVC_5_START_DT yymmdd8.&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/168612"&gt;@424&lt;/a&gt; SRVC_5_END_DT yymmdd8.&lt;BR /&gt;@432 SRVC_5_PL_OF_SRVC $2.&lt;BR /&gt;@434 SRVC_5_PROC_CD $7.&lt;BR /&gt;@447 SRVC_5_REL_DIAG_CD $7.&lt;BR /&gt;@454 SRVC_5_QTY $3.&lt;BR /&gt;@457 SRVC_6_START_DT yymmdd8.&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/115790"&gt;@465&lt;/a&gt; SRVC_6_END_DT yymmdd8.&lt;BR /&gt;@473 SRVC_6_PL_OF_SRVC $2.&lt;BR /&gt;@475 SRVC_6_PROC_CD $7.&lt;BR /&gt;@488 SRVC_6_REL_DIAG_CD $7.&lt;BR /&gt;@495 SRVC_6_QTY $3. @ ;&lt;BR /&gt;INPUT @498 HOSP_SRV_ADMIS_DT_char $8. @ ;&lt;BR /&gt;if HOSP_SRV_ADMIS_DT_char in('00000000',' ') then HOSP_SRV_ADMIS_DT = '31dec9999'd ;&lt;BR /&gt;else do ;&lt;BR /&gt;input @498 HOSP_SRV_ADMIS_DT yymmdd8. @ ;&lt;BR /&gt;end ;&lt;BR /&gt;output HOSP_SRV_ADMIS_DT;&lt;/P&gt;&lt;P&gt;INPUT @506 HOSP_SRVC_ADMIS_TYP_CD $1.&lt;BR /&gt;@507 HOSP_SRVC_ADMIS_SRC_CD $1.&lt;BR /&gt;@508 HOSP_SRVC_DISP_STS_CD $2. @ ;&lt;BR /&gt;INPUT @510 HOSP_SRV_DISP_DT_char $8. @ ;&lt;BR /&gt;if HOSP_SRV_DISP_DT_char in('00000000',' ') then HOSP_SRV_DISP_DT = '31dec9999'd ;&lt;BR /&gt;else do ;&lt;BR /&gt;input @510 HOSP_SRV_DISP_DT yymmdd8. @ ;&lt;BR /&gt;end ;&lt;BR /&gt;output HOSP_SRV_DISP_DT;&lt;/P&gt;&lt;P&gt;INPUT @518 ORIG_DRG_CD $3.&lt;BR /&gt;@521 HOSP_SRV_PROC_1 $7.&lt;BR /&gt;@528 HOSP_SRV_PROC_2 $7.&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/46212"&gt;@535&lt;/a&gt; HOSP_SRV_PROC_3 $7.&lt;BR /&gt;@542 HOSP_SRV_PROC_4 $7.&lt;BR /&gt;@549 HOSP_SRV_PROC_5 $7.&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/14273"&gt;@556&lt;/a&gt; HOSP_SRV_PROC_6 $7.&lt;BR /&gt;@563 POINT_OF_SERVICE $1.&lt;BR /&gt;@564 TRANS_TYP_CD $1.&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;if DMIS_ID = ' ' and DEERS_FAM_ID = ' ' and DEERS_BEN_ID = ' ' and PTNT_ID = ' ' and SPSR_SSN = ' ' then delete;&lt;/P&gt;&lt;P&gt;if DMIS_ID in ('0196','0197') then DMIS_ID = '0192'; /* added 9-16-08 by hjohnson */&lt;/P&gt;&lt;P&gt;if cost = . then cost = 0.0 ;&lt;BR /&gt;if copay = . then copay = 0.0 ;&lt;/P&gt;&lt;P&gt;if ENCTR_SETTING_CD = 'H' and HOSP_SRV_ADMIS_DT = '31dec9999'd then HOSP_SRV_ADMIS_DT = .;&lt;BR /&gt;if ENCTR_SETTING_CD = 'H' and HOSP_SRV_DISP_DT = '31dec9999'd then HOSP_SRV_DISP_DT = .;&lt;/P&gt;&lt;P&gt;if notdigit(ORIG_DRG_CD) = 0 then DRG_CD = left(input(ORIG_DRG_CD,8.)) ;&lt;BR /&gt;else DRG_CD = left(ORIG_DRG_CD) ;&lt;/P&gt;&lt;P&gt;ENCTR_TYP_CD = "&amp;amp;enctr_typ_cd." ;&lt;BR /&gt;output ENCTR_TYP_CD ;&lt;/P&gt;&lt;P&gt;if eof then do ;&lt;BR /&gt;call symput ('end_encounterid',sbmt_rec_idx_nbr) ;&lt;BR /&gt;end ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 18:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546255#M151220</guid>
      <dc:creator>mauri0623</dc:creator>
      <dc:date>2019-03-26T18:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546258#M151221</link>
      <description>&lt;P&gt;Where are these six file names stored? Are they in a text file, an Excel file, or does the program have to read the names of the file from some operating system function (if so, what operating system)?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 18:29:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546258#M151221</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-03-26T18:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546261#M151222</link>
      <description>&lt;P&gt;The files are located on a path called /saswrk0/scp/inbox and they are .DAT files.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 18:34:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546261#M151222</guid>
      <dc:creator>mauri0623</dc:creator>
      <dc:date>2019-03-26T18:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546262#M151223</link>
      <description>&lt;P&gt;Linux.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 18:35:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546262#M151223</guid>
      <dc:creator>mauri0623</dc:creator>
      <dc:date>2019-03-26T18:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546280#M151227</link>
      <description>&lt;P&gt;There are plenty of examples here in SAS communities of a macro, or other code, that will read the names of files from a directory/folder, and then once you have that, you can loop through each name found and perform your task on each file. I have never written one for Linux, so I'll pass, but I suspect it involves the dreaded DREAD function.&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n15scht124hr4nn1g296cqg2kqfa.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n15scht124hr4nn1g296cqg2kqfa.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 19:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546280#M151227</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-03-26T19:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546284#M151230</link>
      <description>Is it only those files to be read in that folder or are there other DAT files? If those are the only files in that folder, change your filename to use a wildcard and it will read all at once.</description>
      <pubDate>Tue, 26 Mar 2019 19:49:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546284#M151230</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-03-26T19:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546363#M151272</link>
      <description>&lt;P&gt;If you want six SAS data sets, you can't name them all MCD.&amp;nbsp; Would it be acceptable to name the SAS data sets:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MCD190&lt;/P&gt;
&lt;P&gt;MCD191&lt;/P&gt;
&lt;P&gt;MCD192&lt;/P&gt;
&lt;P&gt;MCD193&lt;/P&gt;
&lt;P&gt;MCD194&lt;/P&gt;
&lt;P&gt;MCD198&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 02:15:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro/m-p/546363#M151272</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-27T02:15:59Z</dc:date>
    </item>
  </channel>
</rss>

