<?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 Restricting proc sql to pull exact number of numeric character values from a column in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Restricting-proc-sql-to-pull-exact-number-of-numeric-character/m-p/786326#M251039</link>
    <description>&lt;P&gt;Hi experts,&lt;BR /&gt;I have a dataset which has got 4 characters (alphanumeric) and 10 characters(numeric) ids in the SAME column. &lt;BR /&gt;I am trying to separate these into two data sets: one with 4 characters and another with 10 characters.&lt;BR /&gt;I need to join the data set with another to fetch other columns for analysis. The second dataset SEPARATE columns with 4 and 10 student ids. So I joined the 4 character student id from first table with 4 character column from second table easily. &lt;BR /&gt;But joining two tables to pull the 10 character student id has been a challenge to me.&lt;BR /&gt;How to tell sql to pull the student id (from student1) that has got exactly 10 (numeric) characters so that it could be joined on b.stdid (which has 10 numbers)?&lt;BR /&gt;```&lt;BR /&gt;proc sql;&lt;BR /&gt;create table ids as &lt;BR /&gt;select &lt;BR /&gt;a.id,&lt;BR /&gt;b.stdid,&lt;BR /&gt;b.lname,&lt;BR /&gt;b.fname,&lt;BR /&gt;b.mname,&lt;BR /&gt;b.subj,&lt;BR /&gt;b.stream,&lt;BR /&gt;b.gender &lt;BR /&gt;from student1 a &lt;BR /&gt;join student2 b on a.id= b.stdid&lt;BR /&gt;where a.id LIKE '&amp;nbsp; '&lt;/P&gt;
&lt;P&gt;;quit;&lt;BR /&gt;``` &lt;BR /&gt;How to tell proc sql to pull only 10 digit (numeric characters) records only? I could find only wild card characters example on the support forums. I am looking for code to be used within inverted comma( ... a.id LIKE '&amp;lt;what to put here?&amp;gt;'.).&lt;/P&gt;</description>
    <pubDate>Thu, 16 Dec 2021 17:43:06 GMT</pubDate>
    <dc:creator>inquistive</dc:creator>
    <dc:date>2021-12-16T17:43:06Z</dc:date>
    <item>
      <title>Restricting proc sql to pull exact number of numeric character values from a column in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Restricting-proc-sql-to-pull-exact-number-of-numeric-character/m-p/786326#M251039</link>
      <description>&lt;P&gt;Hi experts,&lt;BR /&gt;I have a dataset which has got 4 characters (alphanumeric) and 10 characters(numeric) ids in the SAME column. &lt;BR /&gt;I am trying to separate these into two data sets: one with 4 characters and another with 10 characters.&lt;BR /&gt;I need to join the data set with another to fetch other columns for analysis. The second dataset SEPARATE columns with 4 and 10 student ids. So I joined the 4 character student id from first table with 4 character column from second table easily. &lt;BR /&gt;But joining two tables to pull the 10 character student id has been a challenge to me.&lt;BR /&gt;How to tell sql to pull the student id (from student1) that has got exactly 10 (numeric) characters so that it could be joined on b.stdid (which has 10 numbers)?&lt;BR /&gt;```&lt;BR /&gt;proc sql;&lt;BR /&gt;create table ids as &lt;BR /&gt;select &lt;BR /&gt;a.id,&lt;BR /&gt;b.stdid,&lt;BR /&gt;b.lname,&lt;BR /&gt;b.fname,&lt;BR /&gt;b.mname,&lt;BR /&gt;b.subj,&lt;BR /&gt;b.stream,&lt;BR /&gt;b.gender &lt;BR /&gt;from student1 a &lt;BR /&gt;join student2 b on a.id= b.stdid&lt;BR /&gt;where a.id LIKE '&amp;nbsp; '&lt;/P&gt;
&lt;P&gt;;quit;&lt;BR /&gt;``` &lt;BR /&gt;How to tell proc sql to pull only 10 digit (numeric characters) records only? I could find only wild card characters example on the support forums. I am looking for code to be used within inverted comma( ... a.id LIKE '&amp;lt;what to put here?&amp;gt;'.).&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 17:43:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Restricting-proc-sql-to-pull-exact-number-of-numeric-character/m-p/786326#M251039</guid>
      <dc:creator>inquistive</dc:creator>
      <dc:date>2021-12-16T17:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Restricting proc sql to pull exact number of numeric character values from a column in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Restricting-proc-sql-to-pull-exact-number-of-numeric-character/m-p/786329#M251042</link>
      <description>&lt;P&gt;Use a&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where length(id) = 10&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;clause or a&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;(where=(length(id = 10))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;dataset option.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 17:48:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Restricting-proc-sql-to-pull-exact-number-of-numeric-character/m-p/786329#M251042</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-12-16T17:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Restricting proc sql to pull exact number of numeric character values from a column in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Restricting-proc-sql-to-pull-exact-number-of-numeric-character/m-p/786331#M251043</link>
      <description>where length(a.id) = 10 &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Dec 2021 17:49:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Restricting-proc-sql-to-pull-exact-number-of-numeric-character/m-p/786331#M251043</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-12-16T17:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Restricting proc sql to pull exact number of numeric character values from a column in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Restricting-proc-sql-to-pull-exact-number-of-numeric-character/m-p/786332#M251044</link>
      <description>&lt;P&gt;Can you please provide us some example data? You can use this as a guide:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_blank"&gt;https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could use the LENGTH function? Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id :$10. subj :$10.;
datalines;
STUDENT123 Math
STUDENT242 History
STUDENT223 Reading
S123 Science
S456 Technology
STUDENT211 Spanish
;
run;

proc sql;
	create table want as
		select
					*
		from
					have
		where
					length(id) = 10;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Dec 2021 17:50:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Restricting-proc-sql-to-pull-exact-number-of-numeric-character/m-p/786332#M251044</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2021-12-16T17:50:09Z</dc:date>
    </item>
  </channel>
</rss>

