<?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: Problem in creating SAS dataset with set statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256325#M49110</link>
    <description>&lt;P&gt;Your variable HH7 is numeric - with the HH7A format applied to it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to find the code that matches the formatted value and filter via that method.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or convert variable to character to filter.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*this will display the district coding by extracting info from format. In SPSS this would have been your code table values. ;
Proc format cntlout=fmts;
Run;

Proc print data=fmts;
Where upper(fmtname)='HH7A';
Var fmtname start label;
Run;

Or use the following where clause in your original query:

Put(hh7, hh7a.) = "DISTRICT";&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 12 Mar 2016 19:43:45 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-03-12T19:43:45Z</dc:date>
    <item>
      <title>Problem in creating SAS dataset with set statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256316#M49103</link>
      <description>&lt;P&gt;Hi;&lt;/P&gt;
&lt;P&gt;I have imported a SPSS dataset into SAS. It is a big&amp;nbsp;dataset, but initially I want to work on only one district,but I am unable to create a small dataset having only district level data because of format problem. The variable having names of districts is numeric in the original dataset but when I want to use IF statement, the log says&amp;nbsp;&lt;STRONG&gt;Character values have been converted to numeric values.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;DATA DISTRICT;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SET MYDATA.MICSDAT;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;IF HH7='BAHAWALPUR';&lt;BR /&gt; RUN;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I have also tried Proc Datasets to eliminate format and also tried to convert this variable HH7 to a charachter variable but thngs are not working.&lt;/P&gt;
&lt;P&gt;any suggestion, where i am going wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Haroon&lt;/P&gt;</description>
      <pubDate>Sat, 12 Mar 2016 19:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256316#M49103</guid>
      <dc:creator>Haroon</dc:creator>
      <dc:date>2016-03-12T19:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in creating SAS dataset with set statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256319#M49105</link>
      <description>&lt;P&gt;Please post a proc contents of your data as well as a proc freq of the variable, without formats.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc contents data=mydata.micsdat;
Run;

Proc freq data=mydata.micsdat;
Table hh7;
Format hh7;
Run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 12 Mar 2016 19:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256319#M49105</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-12T19:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in creating SAS dataset with set statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256322#M49108</link>
      <description>&lt;P&gt;Proc Content output&lt;/P&gt;</description>
      <pubDate>Sat, 12 Mar 2016 19:22:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256322#M49108</guid>
      <dc:creator>Haroon</dc:creator>
      <dc:date>2016-03-12T19:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in creating SAS dataset with set statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256323#M49109</link>
      <description>&lt;P&gt;output of Proc freq&lt;/P&gt;</description>
      <pubDate>Sat, 12 Mar 2016 19:24:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256323#M49109</guid>
      <dc:creator>Haroon</dc:creator>
      <dc:date>2016-03-12T19:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in creating SAS dataset with set statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256325#M49110</link>
      <description>&lt;P&gt;Your variable HH7 is numeric - with the HH7A format applied to it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to find the code that matches the formatted value and filter via that method.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or convert variable to character to filter.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*this will display the district coding by extracting info from format. In SPSS this would have been your code table values. ;
Proc format cntlout=fmts;
Run;

Proc print data=fmts;
Where upper(fmtname)='HH7A';
Var fmtname start label;
Run;

Or use the following where clause in your original query:

Put(hh7, hh7a.) = "DISTRICT";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 12 Mar 2016 19:43:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256325#M49110</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-12T19:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in creating SAS dataset with set statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256335#M49114</link>
      <description>&lt;P&gt;Thanks Reeza &amp;nbsp;but PUT function is not working with Where statement. syntax is correct but log says syntax error.&lt;/P&gt;
&lt;P&gt;In the second option I have extracted the format name and labels, but what to do next to get the subset of larger data? If i should merge this fmts data with larger data and then filter by district?&lt;/P&gt;</description>
      <pubDate>Sat, 12 Mar 2016 20:41:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256335#M49114</guid>
      <dc:creator>Haroon</dc:creator>
      <dc:date>2016-03-12T20:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in creating SAS dataset with set statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256339#M49115</link>
      <description>&lt;P&gt;Figure out what number corresponds to your district and change your query to use that number instead of name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or fix your where statement, the theory is correct.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Mar 2016 21:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256339#M49115</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-12T21:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in creating SAS dataset with set statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256340#M49116</link>
      <description>&lt;P&gt;Thanks a lot Reeza your suggestion worked good for me. The obervations under HH7 are coded and I have succeded to filter them but they appear in Print in the form of District names.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Mar 2016 21:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256340#M49116</guid>
      <dc:creator>Haroon</dc:creator>
      <dc:date>2016-03-12T21:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in creating SAS dataset with set statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256341#M49117</link>
      <description>Yes, the format controls appearance. You can use the format from proc freq to remove format. Or proc datasets to remove it permanently.</description>
      <pubDate>Sat, 12 Mar 2016 22:10:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-in-creating-SAS-dataset-with-set-statement/m-p/256341#M49117</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-12T22:10:10Z</dc:date>
    </item>
  </channel>
</rss>

