<?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: Select procedure in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Select-procedure/m-p/644399#M192463</link>
    <description>&lt;P&gt;Please try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
	create table vas_DAD1819 as
	select  unique
			'FY1819' as FY, a.CIHI_KEY, HCNE, a.ADM_DT,
			a.INTERV_CODE_01, a.INTERV_CODE_02, a.INTERV_CODE_03, a.INTERV_CODE_04, a.INTERV_CODE_05,
			a.INTERV_CODE_06, a.INTERV_CODE_07, a.INTERV_CODE_08, a.INTERV_CODE_09, a.INTERV_CODE_10,
			a.INTERV_CODE_11, a.INTERV_CODE_12, a.INTERV_CODE_13, a.INTERV_CODE_14, a.INTERV_CODE_15,
			a.INTERV_CODE_16, a.INTERV_CODE_17, a.INTERV_CODE_18, a.INTERV_CODE_19, a.INTERV_CODE_20,
			b.*
	from 
		test.DAD1819 as a left join 
		Vas_code as b on 
			whichc ( 	CCI_code_new, 
				substr(a.INTERV_CODE_01,1,5),
				substr(a.INTERV_CODE_02,1,5),
				substr(a.INTERV_CODE_03,1,5),
				substr(a.INTERV_CODE_04,1,5),
				substr(a.INTERV_CODE_05,1,5),
				substr(a.INTERV_CODE_06,1,5),
				substr(a.INTERV_CODE_07,1,5),
				substr(a.INTERV_CODE_08,1,5),
				substr(a.INTERV_CODE_09,1,5),
				substr(a.INTERV_CODE_10,1,5),
				substr(a.INTERV_CODE_11,1,5),
				substr(a.INTERV_CODE_12,1,5),
				substr(a.INTERV_CODE_13,1,5),
				substr(a.INTERV_CODE_14,1,5),
				substr(a.INTERV_CODE_15,1,5),
				substr(a.INTERV_CODE_16,1,5),
				substr(a.INTERV_CODE_17,1,5),
				substr(a.INTERV_CODE_18,1,5),
				substr(a.INTERV_CODE_19,1,5),
				substr(a.INTERV_CODE_20,1,5) 
				) &amp;gt; 0
	;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(not tested)&lt;/P&gt;</description>
    <pubDate>Thu, 30 Apr 2020 22:13:16 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2020-04-30T22:13:16Z</dc:date>
    <item>
      <title>Select procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-procedure/m-p/644340#M192450</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; create table vas_DAD1819 as
	select 'FY1819' as FY, CIHI_KEY, HCNE, ADM_DT,
			INTERV_CODE_01, INTERV_CODE_02, INTERV_CODE_03, INTERV_CODE_04, INTERV_CODE_05,
			INTERV_CODE_06, INTERV_CODE_07, INTERV_CODE_08, INTERV_CODE_09, INTERV_CODE_10,
			INTERV_CODE_11, INTERV_CODE_12, INTERV_CODE_13, INTERV_CODE_14, INTERV_CODE_15,
			INTERV_CODE_16, INTERV_CODE_17, INTERV_CODE_18, INTERV_CODE_19, INTERV_CODE_20
	from test.DAD1819
	where substr (INTERV_CODE_01,1,5) in (select CCI_code_new from vas_code)
		OR substr (INTERV_CODE_02,1,5) in (select CCI_code_new from vas_code)
;
quit;
proc sql; create table vas_DAD1819 as
	select 'FY1819' as FY, a.CIHI_KEY, HCNE, a.ADM_DT,
			a.INTERV_CODE_01, a.INTERV_CODE_02, a.INTERV_CODE_03, a.INTERV_CODE_04, a.INTERV_CODE_05,
			a.INTERV_CODE_06, a.INTERV_CODE_07, a.INTERV_CODE_08, a.INTERV_CODE_09, a.INTERV_CODE_10,
			a.INTERV_CODE_11, a.INTERV_CODE_12, a.INTERV_CODE_13, a.INTERV_CODE_14, a.INTERV_CODE_15,
			a.INTERV_CODE_16, a.INTERV_CODE_17, a.INTERV_CODE_18, a.INTERV_CODE_19, a.INTERV_CODE_20,
			b.*
	from test.DAD1819 as a left join Vas_code as b
	on substr(a.INTERV_CODE_01,1,5) in 
			(select CCI_code_new from vas_code)
	;
	quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Would appreciate if you can advise if which of the following codes would do the below correctly:&lt;/P&gt;&lt;P&gt;I have select CCI code new in a seperate dataset&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to select all cases from DAD1819 where any of the&amp;nbsp;&lt;CODE class=" language-sas"&gt;INTERV_CODE_01 to&amp;nbsp;INTERV_CODE_20&amp;nbsp;fields&amp;nbsp;have&amp;nbsp;the&amp;nbsp;codes&amp;nbsp;from&amp;nbsp;the&amp;nbsp;CCI&amp;nbsp;code&amp;nbsp;new&amp;nbsp;list&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;In the 1st code would it be correct to keep adding all the 20 variables i.e.&amp;nbsp;&lt;CODE class=" language-sas"&gt;INTERV_CODE_XX&amp;nbsp;using&amp;nbsp;the&amp;nbsp;OR&amp;nbsp;statement&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 18:41:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-procedure/m-p/644340#M192450</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2020-04-30T18:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Select procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-procedure/m-p/644399#M192463</link>
      <description>&lt;P&gt;Please try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
	create table vas_DAD1819 as
	select  unique
			'FY1819' as FY, a.CIHI_KEY, HCNE, a.ADM_DT,
			a.INTERV_CODE_01, a.INTERV_CODE_02, a.INTERV_CODE_03, a.INTERV_CODE_04, a.INTERV_CODE_05,
			a.INTERV_CODE_06, a.INTERV_CODE_07, a.INTERV_CODE_08, a.INTERV_CODE_09, a.INTERV_CODE_10,
			a.INTERV_CODE_11, a.INTERV_CODE_12, a.INTERV_CODE_13, a.INTERV_CODE_14, a.INTERV_CODE_15,
			a.INTERV_CODE_16, a.INTERV_CODE_17, a.INTERV_CODE_18, a.INTERV_CODE_19, a.INTERV_CODE_20,
			b.*
	from 
		test.DAD1819 as a left join 
		Vas_code as b on 
			whichc ( 	CCI_code_new, 
				substr(a.INTERV_CODE_01,1,5),
				substr(a.INTERV_CODE_02,1,5),
				substr(a.INTERV_CODE_03,1,5),
				substr(a.INTERV_CODE_04,1,5),
				substr(a.INTERV_CODE_05,1,5),
				substr(a.INTERV_CODE_06,1,5),
				substr(a.INTERV_CODE_07,1,5),
				substr(a.INTERV_CODE_08,1,5),
				substr(a.INTERV_CODE_09,1,5),
				substr(a.INTERV_CODE_10,1,5),
				substr(a.INTERV_CODE_11,1,5),
				substr(a.INTERV_CODE_12,1,5),
				substr(a.INTERV_CODE_13,1,5),
				substr(a.INTERV_CODE_14,1,5),
				substr(a.INTERV_CODE_15,1,5),
				substr(a.INTERV_CODE_16,1,5),
				substr(a.INTERV_CODE_17,1,5),
				substr(a.INTERV_CODE_18,1,5),
				substr(a.INTERV_CODE_19,1,5),
				substr(a.INTERV_CODE_20,1,5) 
				) &amp;gt; 0
	;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(not tested)&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 22:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-procedure/m-p/644399#M192463</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-04-30T22:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Select procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-procedure/m-p/644416#M192470</link>
      <description>All the referenced fields are character How would i change all the fields to numeric</description>
      <pubDate>Fri, 01 May 2020 00:04:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-procedure/m-p/644416#M192470</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2020-05-01T00:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Select procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-procedure/m-p/644455#M192485</link>
      <description>&lt;P&gt;To convert the character codes to numbers in the output table, replace&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;a.INTERV_CODE_01,&lt;/LI-CODE&gt;
&lt;P&gt;with&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;input(a.INTERV_CODE_01, best.),&lt;/LI-CODE&gt;
&lt;P&gt;in the selected list of variables&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 04:48:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-procedure/m-p/644455#M192485</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-05-01T04:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-procedure/m-p/644465#M192491</link>
      <description>&lt;P&gt;This is another classic example where bad dataset structure makes the SAS coder's life miserable. With a longitudinal dataset, the code would be much easier. Please supply example data for tables DAD1819 and VAS_CODE, so I can provide code.&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 07:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-procedure/m-p/644465#M192491</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-01T07:25:58Z</dc:date>
    </item>
  </channel>
</rss>

