<?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: Need help converting SAS code to SQL in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189146#M47798</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you moving to SAS SQL or doing this on a database?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Apr 2014 15:18:50 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-04-22T15:18:50Z</dc:date>
    <item>
      <title>Need help converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189141#M47793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My name is Sara.&lt;/P&gt;&lt;P&gt;I am trying to convert a SAS code to SQL procedure.&lt;/P&gt;&lt;P&gt;Since i am not familiar with SAS can any one help me to convert the code to SQL procedure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 13:58:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189141#M47793</guid>
      <dc:creator>sara88</dc:creator>
      <dc:date>2014-04-22T13:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189142#M47794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SQL is only a very small subset of SAS.&lt;/P&gt;&lt;P&gt;You can have SQL into SAS to other way is not easy of even not possible. If your question would be can I convert Java into SQL that is easier to see. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 14:33:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189142#M47794</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-04-22T14:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189143#M47795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jaap,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes I am getting that by looking at the code. Just trying if somebody can tell me what my code is doing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Radhika.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 14:53:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189143#M47795</guid>
      <dc:creator>sara88</dc:creator>
      <dc:date>2014-04-22T14:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189144#M47796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Depends on why and the complexity of the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think anyone on here will convert a 500 line program to SQL for you. A single or few datasteps perhaps.&lt;/P&gt;&lt;P&gt;Also, are you moving to PROC SQL or SQL in a database and bypassing SAS entirely?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And no one can help if you don't post the code &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 14:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189144#M47796</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-22T14:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189145#M47797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my code.&lt;/P&gt;&lt;P&gt;Source files: tbsisstu, tbsisenrl, and tb_cds_mst&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---&amp;nbsp;&amp;nbsp;&amp;nbsp; Student File&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from sis..tbsisstu&lt;/P&gt;&lt;P&gt;order by intsystemstuid&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;----&amp;nbsp;&amp;nbsp; Enrollment file&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set nocount on&lt;/P&gt;&lt;P&gt;Select * &lt;/P&gt;&lt;P&gt;from sis..tbsisenrl&lt;/P&gt;&lt;P&gt;where chrSchYr=2014&lt;/P&gt;&lt;P&gt;order by intsystemstuid&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Import both files to my U drive&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For enrollment file,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the SAS codes&lt;/P&gt;&lt;P&gt;format rcdts $15. rcdt $11.;&lt;/P&gt;&lt;P&gt;rcdts=upcase(chrRCDTSServing) ;&lt;/P&gt;&lt;P&gt;rcdt=substr(rcdts,1,11);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Use serving unless type deigns with ‘4’&lt;/P&gt;&lt;P&gt;if substr(rcdts,10,1) = '4' then rcdts=upcase(chrRCDTSHome);&lt;/P&gt;&lt;P&gt; Omit birth to three&lt;/P&gt;&lt;P&gt;if dtmEnrlDate&amp;lt;'2012-10-01 00:00:00.000' and &lt;/P&gt;&lt;P&gt;(dtmExitDate&amp;gt;='2012-09-30 00:00:00.000' or dtmExitDate='NULL') ;&lt;/P&gt;&lt;P&gt;if intEnrlExitType NE '23';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=2 then delete;&lt;/P&gt;&lt;P&gt;cnt=1;&lt;/P&gt;&lt;P&gt; Omit districts that end in XYZPS for region and county not sevens&lt;/P&gt;&lt;P&gt;if substr(rcdts,1,5) NE '77777';&lt;/P&gt;&lt;P&gt;if substr(rcdts,9,1) in ('X','Y','Z','P','S') then delete;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format rcdt $11.;&lt;/P&gt;&lt;P&gt;rcdt=substr(rcdts,1,11);cnt=1;&lt;/P&gt;&lt;P&gt;dty=substr(rcdts,10,1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=enr;by descending decFTE descending intEnrlId;&lt;/P&gt;&lt;P&gt;proc sort nodupkey;by intSystemStuId ;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then merge both file together by intSystemStuId.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data demox1;merge demo enr(in=x);by intSystemStuId;if x;&lt;/P&gt;&lt;P&gt;format grade $2.;&lt;/P&gt;&lt;P&gt;if intEntryGrdId=3 then grade='PK';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=4 then grade='KG';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=5 then grade='01';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=6 then grade='02';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=7 then grade='03';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=8 then grade='04';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=9 then grade='05';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=10 then grade='06';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=11 then grade='07';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=12 then grade='08';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=13 then grade='09';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=14 then grade='10';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=15 then grade='11';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=16 then grade='12';&lt;/P&gt;&lt;P&gt;if intEntryGrdId=. then grade='UG';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort;by rcdts;&lt;/P&gt;&lt;P&gt;input EPS file,&lt;/P&gt;&lt;P&gt;DATA CDSfile;&lt;/P&gt;&lt;P&gt;infile 'u:\cdsfile\CDS_rc13.txt' delimiter = '|' dsd missover pad lrecl=9327 firstobs=2 ;&lt;/P&gt;&lt;P&gt;format RCD $9. Sch $4. ff $2. Cat $1. DTYPE $2. reg $ 1. ADMIN $33. sNAME $40. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADDRESS $20. CITY $20. STATE $2. ZIP $8. PHONE $11. xx1-xx11 $8. cong $2. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xx13-xx16 $3. enr_cds 7. ypk $1. yk $1. yg1-yg12 $1. y1-y5 $1. fax $15. z1-z2 $2. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; email $55.;&lt;/P&gt;&lt;P&gt;input RCD $ Sch $ ff $ CAT $ DTYPE $ reg $ ADMIN $ sNAME $ ADDRESS $ city $ &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; STATE $ ZIP $ PHONE $ xx1-xx11 $ cong $ xx13-xx16 $ enr_cds ypk $ yk $ yg1-yg12 $&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y1-y5 $ fax $ z1-z2 $ email $;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format rcdt $11. rcdts $15.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rcdt=rcd||dtype;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rcdts=rcdt||sch;&lt;/P&gt;&lt;P&gt;if cat in ('C','E','5',' ','D') then delete;&lt;/P&gt;&lt;P&gt;proc sort;by rcdts;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Merge EPS file with student file and remove the enrollment from category C, E, 5, and D.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data demox2;merge cdsfile(in=x) demox1(in=y);&lt;/P&gt;&lt;P&gt;by rcdts;if x and y;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calculate the counts by grade, gender, and race. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 15:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189145#M47797</guid>
      <dc:creator>sara88</dc:creator>
      <dc:date>2014-04-22T15:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189146#M47798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you moving to SAS SQL or doing this on a database?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 15:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189146#M47798</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-22T15:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189147#M47799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am doing this in a database&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 15:19:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189147#M47799</guid>
      <dc:creator>sara88</dc:creator>
      <dc:date>2014-04-22T15:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189148#M47800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then as a personal rule, I generally don't help with those questions on here, others will.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider this step in the SAS process though. That's a data import step, if you're in SQL server you'll need to build an SSIS job for that, this won't be a straight conversion from SAS code to SQL code.&lt;/P&gt;&lt;P&gt;Good Luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA CDSfile;&lt;/P&gt;&lt;P&gt;infile 'u:\cdsfile\CDS_rc13.txt' delimiter = '|' dsd missover pad lrecl=9327 firstobs=2 ;&lt;/P&gt;&lt;P&gt;format RCD $9. Sch $4. ff $2. Cat $1. DTYPE $2. reg $ 1. ADMIN $33. sNAME $40. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADDRESS $20. CITY $20. STATE $2. ZIP $8. PHONE $11. xx1-xx11 $8. cong $2. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xx13-xx16 $3. enr_cds 7. ypk $1. yk $1. yg1-yg12 $1. y1-y5 $1. fax $15. z1-z2 $2. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; email $55.;&lt;/P&gt;&lt;P&gt;input RCD $ Sch $ ff $ CAT $ DTYPE $ reg $ ADMIN $ sNAME $ ADDRESS $ city $ &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; STATE $ ZIP $ PHONE $ xx1-xx11 $ cong $ xx13-xx16 $ enr_cds ypk $ yk $ yg1-yg12 $&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y1-y5 $ fax $ z1-z2 $ email $;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format rcdt $11. rcdts $15.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rcdt=rcd||dtype;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rcdts=rcdt||sch;&lt;/P&gt;&lt;P&gt;if cat in ('C','E','5',' ','D') then delete;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 15:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189148#M47800</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-22T15:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189149#M47801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Reeza. I will try this in SSIS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 15:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-converting-SAS-code-to-SQL/m-p/189149#M47801</guid>
      <dc:creator>sara88</dc:creator>
      <dc:date>2014-04-22T15:38:02Z</dc:date>
    </item>
  </channel>
</rss>

