<?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: String or Scan Function to solve height format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/String-or-Scan-Function-to-solve-height-format/m-p/598838#M172740</link>
    <description>&lt;P&gt;First set of questions:&amp;nbsp; What are you doing with data?&amp;nbsp; How do you plan to manipulate it?&lt;/P&gt;</description>
    <pubDate>Wed, 23 Oct 2019 20:59:41 GMT</pubDate>
    <dc:creator>PabloNogueras</dc:creator>
    <dc:date>2019-10-23T20:59:41Z</dc:date>
    <item>
      <title>String or Scan Function to solve height format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/String-or-Scan-Function-to-solve-height-format/m-p/598831#M172734</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imported a dataset from Excel and height variable contains the symbols for feet and inches. Currently SAS read it as Char. Could you please advise me how to clean up this format issue? Or how do use the string or scan function?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;height&lt;/STRONG&gt;&lt;BR /&gt;5' 2.795"&lt;BR /&gt;5' 1.614"&lt;BR /&gt;4' .5"&lt;BR /&gt;5' 2.402"&lt;BR /&gt;3' 7.78"&lt;BR /&gt;3' 3.764"&lt;BR /&gt;5' 7"&lt;BR /&gt;5' 2.52"&lt;BR /&gt;5' 4.5"&lt;BR /&gt;5' 4"&lt;BR /&gt;5' 6.378"&lt;BR /&gt;5' 3"&lt;BR /&gt;5' 7.323"&lt;BR /&gt;4' .622"&lt;BR /&gt;5' 8"&lt;BR /&gt;5' 10.25"&lt;BR /&gt;5' 5.118"&lt;BR /&gt;5' 6.732"&lt;BR /&gt;3' 11.441"&lt;BR /&gt;4' 9"&lt;BR /&gt;4' 11.449"&lt;BR /&gt;3' 10"&lt;BR /&gt;4' 9.323"&lt;BR /&gt;4' 11.5"&lt;BR /&gt;4' 5.15"&lt;BR /&gt;3' 5.929"&lt;BR /&gt;4' 1.409"&lt;BR /&gt;5' 3.5"&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 20:35:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/String-or-Scan-Function-to-solve-height-format/m-p/598831#M172734</guid>
      <dc:creator>Denali</dc:creator>
      <dc:date>2019-10-23T20:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: String or Scan Function to solve height format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/String-or-Scan-Function-to-solve-height-format/m-p/598838#M172740</link>
      <description>&lt;P&gt;First set of questions:&amp;nbsp; What are you doing with data?&amp;nbsp; How do you plan to manipulate it?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 20:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/String-or-Scan-Function-to-solve-height-format/m-p/598838#M172740</guid>
      <dc:creator>PabloNogueras</dc:creator>
      <dc:date>2019-10-23T20:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: String or Scan Function to solve height format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/String-or-Scan-Function-to-solve-height-format/m-p/598840#M172742</link>
      <description>&lt;P&gt;If you are looking to get feet and inches as numeric values here is one way:&lt;/P&gt;
&lt;PRE&gt;data example;
   input str $ 1-9;
   feet = input(scan(str,1,"'"),f1.);
   inches= input(scan(str,2," '"""),best.);

datalines;
5' 2.795"
5' 1.614"
4' .5"
5' 2.402"
3' 7.78"
3' 3.764"
5' 7"
5' 2.52"
5' 4.5"
5' 4"
5' 6.378"
5' 3"
5' 7.323"
;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Oct 2019 21:16:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/String-or-Scan-Function-to-solve-height-format/m-p/598840#M172742</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-10-23T21:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: String or Scan Function to solve height format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/String-or-Scan-Function-to-solve-height-format/m-p/598844#M172745</link>
      <description>&lt;P&gt;You could construct an informat that uses regular expressions as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  invalue inft  (default=2)  "s/'//" (regexpe) = _same_ other=_same_;
  invalue inin(default=6) 's/"//' (regexpe) = _same_ other=_same_; 
run;

data want;
  input  ft  inft2. inch :inin.;
  total_height=12*ft+inch;
  if _n_=1 then put (_all_) (=);
datalines;
5' 2.795"
5' 1.614"
4' .5"
5' 2.402"
3' 7.78"
3' 3.764"
5' 7"
5' 2.52"
5' 4.5"
5' 4"
5' 6.378"
5' 3"
5' 7.323"
4' .622"
5' 8"
5' 10.25"
5' 5.118"
5' 6.732"
3' 11.441"
4' 9"
4' 11.449"
3' 10"
4' 9.323"
4' 11.5"
4' 5.15"
3' 5.929"
4' 1.409"
5' 3.5"
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I suppose one could construct a regular expression that simultaneously read in the feet and inches and calculate a correct height in either inches or feet, but this is as far as I would go.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 21:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/String-or-Scan-Function-to-solve-height-format/m-p/598844#M172745</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-10-23T21:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: String or Scan Function to solve height format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/String-or-Scan-Function-to-solve-height-format/m-p/598918#M172800</link>
      <description>&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2019 04:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/String-or-Scan-Function-to-solve-height-format/m-p/598918#M172800</guid>
      <dc:creator>Denali</dc:creator>
      <dc:date>2019-10-24T04:36:42Z</dc:date>
    </item>
  </channel>
</rss>

