<?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 show for the same variable some observations as numeric and some as date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319301#M70093</link>
    <description>&lt;P&gt;Dear expert,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;after some checks I get a data set with the following structure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data b;&lt;BR /&gt;input type: $12. variable: $12. variable_min;&lt;BR /&gt;datalines;&lt;BR /&gt;date begin 2000&lt;BR /&gt;num price 3000&lt;BR /&gt;date end 2500&lt;BR /&gt;;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I show for the same variable (variable_min) in some cases (when type='date') as date and in some cases (when type='num') as numeric?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance, SH.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Dec 2016 16:15:56 GMT</pubDate>
    <dc:creator>Sir_Highbury</dc:creator>
    <dc:date>2016-12-15T16:15:56Z</dc:date>
    <item>
      <title>show for the same variable as numeric or date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319302#M70087</link>
      <description>&lt;P&gt;Dear expert,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;after some checks I get a data set with the following structure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data b;&lt;BR /&gt;input type: $12. variable: $12. variable_min;&lt;BR /&gt;datalines;&lt;BR /&gt;date begin 2000&lt;BR /&gt;num price 3000&lt;BR /&gt;date end 2500&lt;BR /&gt;;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I show for the same variable (variable_min) in some cases (when type='date') as date and in some cases (when type='num') as numeric?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance, SH.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 16:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319302#M70087</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-12-15T16:16:52Z</dc:date>
    </item>
    <item>
      <title>show for the same variable some observations as numeric and some as date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319301#M70093</link>
      <description>&lt;P&gt;Dear expert,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;after some checks I get a data set with the following structure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data b;&lt;BR /&gt;input type: $12. variable: $12. variable_min;&lt;BR /&gt;datalines;&lt;BR /&gt;date begin 2000&lt;BR /&gt;num price 3000&lt;BR /&gt;date end 2500&lt;BR /&gt;;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I show for the same variable (variable_min) in some cases (when type='date') as date and in some cases (when type='num') as numeric?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance, SH.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 16:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319301#M70093</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-12-15T16:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: show for the same variable some observations as numeric and some as date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319305#M70094</link>
      <description>&lt;P&gt;It depends on what you mean by "show". If you mean display in the log then you can&lt;/P&gt;
&lt;P&gt;precise the display format in the put statement :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data b;
	input type: $12. variable: $12. variable_min;

	if type="date" then do;
		put variable_min= date6.;
	end;
	else do;
		put variable_min;
	end;

	datalines;
date begin 2000
num price 3000
date end 2500
	;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Dec 2016 16:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319305#M70094</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2016-12-15T16:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: show for the same variable as numeric or date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319306#M70089</link>
      <description>&lt;P&gt;You would have to show the output you want for your example data? Do you want to create a new variable or are attempting to do the desired display in another procedure (unlikely to work).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 16:22:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319306#M70089</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-15T16:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: show for the same variable as numeric or date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319309#M70092</link>
      <description>&lt;P&gt;Have a character variable (only character can hol any value):&lt;/P&gt;
&lt;PRE&gt;data b;
  length result $200;
  input type: $12. variable: $12. variable_min;
  select(type);
    when("date") result=put(variable_min,date9.);
    when("num") result=put(variable_min,best.);
    otherwise;
  end;
datalines;
date begin 2000
num price 3000
date end 2500
;
run;&lt;/PRE&gt;
&lt;P&gt;Then put your number data in the correct text format.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 16:28:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319309#M70092</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-15T16:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: show for the same variable as numeric or date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319310#M70095</link>
      <description>I assume that want to use different SAS format depending on the type variable. This has a question here from time to time, and cannot be done by standard means.&lt;BR /&gt;As a storage pattern it's not a favourite of mine, even if some industry data models have this construct.&lt;BR /&gt;Either way, the easiest way is to use a CHAR data type.</description>
      <pubDate>Thu, 15 Dec 2016 16:30:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319310#M70095</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-12-15T16:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: show for the same variable some observations as numeric and some as date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319327#M70106</link>
      <description>&lt;P&gt;Repeating the question without additional information is not very helpful.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 17:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319327#M70106</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-15T17:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: show for the same variable some observations as numeric and some as date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319467#M70174</link>
      <description>&lt;P&gt;of course, sorry I did it by mistake.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 08:24:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/show-for-the-same-variable-as-numeric-or-date/m-p/319467#M70174</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-12-16T08:24:26Z</dc:date>
    </item>
  </channel>
</rss>

