<?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 create the .sas file from the sas code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-the-sas-file-from-the-sas-code/m-p/601341#M173928</link>
    <description>&lt;P&gt;hi gamotte,&lt;/P&gt;&lt;P&gt;Thanks for your reply. am creating the sas package for the sas di jobs by using the attached code like the same way i want to create the .sas files (dot sas files).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for this am passing the sas di job names as the input&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Filename LFYXIN01 "&amp;amp;FILENAME";

PROC IMPORT OUT= WORK.JOBS 
            DATAFILE= LFYXIN01 
            DBMS=TAB REPLACE;
     GETNAMES=NO;
     DATAROW=1; 
RUN;

	data test (drop=cmd);
	set JOBS;
	LNOMJOB=compress('"'!!"\\jafile01\sdtmaps\" !!substr(Var1,3,2)!!"\"!!var1!!".spk"!!'"') ;
	LNOMLOG=compress('"'!!"\\jafile01\sdtmaps\Export_Logs\"!!var1!!".LOG"!!'"') ;
*Put LNOMJOB;
cmd ='J:\SASHome\SASPlatformObjectFramework\9.4\EXPORTPackage -host SDSASA01 -port 8561 -user ' !! "&amp;amp;userID" !! ' -password ' !! "&amp;amp;user_password" !! ' -package ' !! LNOMJOB !! 
' -objects "/" -name ' !! var1 !!' -nameMatchType EQUALS -includeDesc -types "Job,ExternalFile" -excludeSubTypes -log ' !!LNOMLOG ;

	call system(cmd);
	run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;input&amp;nbsp;&lt;/P&gt;&lt;P&gt;JSYM8ABCTABLECOP&lt;/P&gt;&lt;P&gt;JSYM8ABCTABLEAUDBEG&lt;/P&gt;&lt;P&gt;JSYM8ABCTABLEAUDFIN&lt;/P&gt;&lt;P&gt;JSYM8ABCTABLE&lt;/P&gt;&lt;P&gt;for the 4 job names am creating the 4 pacakges like the same i want to create the .sas files (dot sas files).&lt;/P&gt;</description>
    <pubDate>Mon, 04 Nov 2019 10:51:39 GMT</pubDate>
    <dc:creator>sasismylife</dc:creator>
    <dc:date>2019-11-04T10:51:39Z</dc:date>
    <item>
      <title>how to create the .sas file from the sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-the-sas-file-from-the-sas-code/m-p/601328#M173917</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create the .sas file from sas code. Could you please help me how to create the .sas files.&lt;/P&gt;&lt;P&gt;Am using sas 9.4 version.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 10:07:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-the-sas-file-from-the-sas-code/m-p/601328#M173917</guid>
      <dc:creator>sasismylife</dc:creator>
      <dc:date>2019-11-04T10:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to create the .sas file from the sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-the-sas-file-from-the-sas-code/m-p/601334#M173922</link>
      <description>File -&amp;gt; Save as... ?&lt;BR /&gt;&lt;BR /&gt;Please be more specific : what file do you want to create from which code ?</description>
      <pubDate>Mon, 04 Nov 2019 10:27:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-the-sas-file-from-the-sas-code/m-p/601334#M173922</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-11-04T10:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to create the .sas file from the sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-the-sas-file-from-the-sas-code/m-p/601341#M173928</link>
      <description>&lt;P&gt;hi gamotte,&lt;/P&gt;&lt;P&gt;Thanks for your reply. am creating the sas package for the sas di jobs by using the attached code like the same way i want to create the .sas files (dot sas files).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for this am passing the sas di job names as the input&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Filename LFYXIN01 "&amp;amp;FILENAME";

PROC IMPORT OUT= WORK.JOBS 
            DATAFILE= LFYXIN01 
            DBMS=TAB REPLACE;
     GETNAMES=NO;
     DATAROW=1; 
RUN;

	data test (drop=cmd);
	set JOBS;
	LNOMJOB=compress('"'!!"\\jafile01\sdtmaps\" !!substr(Var1,3,2)!!"\"!!var1!!".spk"!!'"') ;
	LNOMLOG=compress('"'!!"\\jafile01\sdtmaps\Export_Logs\"!!var1!!".LOG"!!'"') ;
*Put LNOMJOB;
cmd ='J:\SASHome\SASPlatformObjectFramework\9.4\EXPORTPackage -host SDSASA01 -port 8561 -user ' !! "&amp;amp;userID" !! ' -password ' !! "&amp;amp;user_password" !! ' -package ' !! LNOMJOB !! 
' -objects "/" -name ' !! var1 !!' -nameMatchType EQUALS -includeDesc -types "Job,ExternalFile" -excludeSubTypes -log ' !!LNOMLOG ;

	call system(cmd);
	run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;input&amp;nbsp;&lt;/P&gt;&lt;P&gt;JSYM8ABCTABLECOP&lt;/P&gt;&lt;P&gt;JSYM8ABCTABLEAUDBEG&lt;/P&gt;&lt;P&gt;JSYM8ABCTABLEAUDFIN&lt;/P&gt;&lt;P&gt;JSYM8ABCTABLE&lt;/P&gt;&lt;P&gt;for the 4 job names am creating the 4 pacakges like the same i want to create the .sas files (dot sas files).&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 10:51:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-the-sas-file-from-the-sas-code/m-p/601341#M173928</guid>
      <dc:creator>sasismylife</dc:creator>
      <dc:date>2019-11-04T10:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to create the .sas file from the sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-the-sas-file-from-the-sas-code/m-p/601412#M173951</link>
      <description>&lt;P&gt;It is not at all clear what your question is.&lt;/P&gt;
&lt;P&gt;So for each of those names you want to create a SAS program file?&amp;nbsp; What SAS code are you going to put into the file(s)? How is it going to be different for each of the values from your input file?&lt;/P&gt;
&lt;P&gt;How is this related to SAS/DI?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But we can provide some feedback on the code you posted.&lt;/P&gt;
&lt;P&gt;Why are you using PROC IMPORT to read a text file? Especially one that only has one variable? Just read the file.&lt;/P&gt;
&lt;P&gt;You could read the full line into your character variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.JOBS  ;
  infile LFYXIN01 truncover ;
  input var1 $100. ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or if it actually has tabs you can read the first column.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.JOBS  ;
  infile LFYXIN01 dsd dlm='09'x truncover ;
  input var1 :$100. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To simplify your command generation. You can use the new CAT...() series of functions instead of just use in the || operator.&lt;/P&gt;
&lt;P&gt;Also why are you using the COMPRESS() function?&amp;nbsp; Is it just to remove the trailing spaces from the variable values?&amp;nbsp; If so then use the CATS() or CATX() function which will automatically strip the leading/trailing spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  set JOBS;
  length LNOMJOB LNOMLOG $200 CMD $1000 ;
  LNOMJOB=quote(cats('\\jafile01\sdtmaps\',substr(Var1,3,2),'\',var1,'.spk'));
  LNOMLOG=quote(cats('\\jafile01\sdtmaps\Export_Logs\',var1,'.LOG')) ;
  cmd = catx(' '
      ,'J:\SASHome\SASPlatformObjectFramework\9.4\EXPORTPackage'
      ,'-host SDSASA01'
      ,'-port 8561'
      ,'-user',"&amp;amp;userID"
      ,'-password',"&amp;amp;user_password"
      ,'-package',LNOMJOB
      ,'-objects "/"'
      ,'-name',var1
      ,'-nameMatchType EQUALS'
      ,'-includeDesc'
      ,'-types "Job,ExternalFile"'
      ,'-excludeSubTypes'
      ,'-log',LNOMLOG 
  );
  call system(cmd);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 15:43:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-the-sas-file-from-the-sas-code/m-p/601412#M173951</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-04T15:43:22Z</dc:date>
    </item>
  </channel>
</rss>

