<?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: Concatenating date variable with numeric variable in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117216#M10293</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Another way is to create a function with Proc Fcmp that calculates the age. From this, you can create a format that you can use on a date variable, to display both the date and the age.&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Create function*/&lt;/P&gt;&lt;P&gt;proc fcmp outlib=work.myfunc.group;&lt;BR /&gt;&amp;nbsp; function fmtfunc(dob) $ 20;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; length text $ 20;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; age=int(yrdif(dob,today(),'age')); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; text=cats(put(dob,date9.),'(',put(age,3.),')');&lt;BR /&gt; return(text);&lt;BR /&gt;&amp;nbsp; endsub;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Tell Sas where to fund the function*/&lt;/P&gt;&lt;P&gt;options cmplib=work.myfunc;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;/*Create a format that you can use on yout date variable*/&lt;/P&gt;&lt;P&gt;proc format;&lt;BR /&gt;&amp;nbsp; value agefmt (default=20) other=[fmtfunc()] ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc print data=testData;&lt;BR /&gt;&amp;nbsp; format dob agefmt.;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Jan 2013 12:42:51 GMT</pubDate>
    <dc:creator>Fraktalnisse</dc:creator>
    <dc:date>2013-01-07T12:42:51Z</dc:date>
    <item>
      <title>Concatenating date variable with numeric variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117214#M10291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to concatenate date variable and numeric variable together in Proc Report???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having two variables in my dataset DOB and Age..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to show there variables together in date&amp;nbsp; column like 21Jan1988(25)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp;regards..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sanjeev.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jan 2013 11:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117214#M10291</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-01-07T11:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating date variable with numeric variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117215#M10292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;One solution is to convert the values to text with the function PUT, and then create a text variable from this.&lt;/P&gt;&lt;P&gt;Mabye something like this:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*Create data with numeric variables*/&lt;BR /&gt;data testData;&lt;BR /&gt;&amp;nbsp; dob='21jan1988'd;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; age=25;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Create text variable for presentation*/&lt;BR /&gt;data testData;&lt;BR /&gt;&amp;nbsp; set testData;&lt;BR /&gt;&amp;nbsp; text=cats(put(dob,date9.),'(',put(age,3.),')');&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jan 2013 12:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117215#M10292</guid>
      <dc:creator>Fraktalnisse</dc:creator>
      <dc:date>2013-01-07T12:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating date variable with numeric variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117216#M10293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Another way is to create a function with Proc Fcmp that calculates the age. From this, you can create a format that you can use on a date variable, to display both the date and the age.&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Create function*/&lt;/P&gt;&lt;P&gt;proc fcmp outlib=work.myfunc.group;&lt;BR /&gt;&amp;nbsp; function fmtfunc(dob) $ 20;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; length text $ 20;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; age=int(yrdif(dob,today(),'age')); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; text=cats(put(dob,date9.),'(',put(age,3.),')');&lt;BR /&gt; return(text);&lt;BR /&gt;&amp;nbsp; endsub;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Tell Sas where to fund the function*/&lt;/P&gt;&lt;P&gt;options cmplib=work.myfunc;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;/*Create a format that you can use on yout date variable*/&lt;/P&gt;&lt;P&gt;proc format;&lt;BR /&gt;&amp;nbsp; value agefmt (default=20) other=[fmtfunc()] ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc print data=testData;&lt;BR /&gt;&amp;nbsp; format dob agefmt.;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jan 2013 12:42:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117216#M10293</guid>
      <dc:creator>Fraktalnisse</dc:creator>
      <dc:date>2013-01-07T12:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating date variable with numeric variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117217#M10294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sanjeev,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you try the below code, using the compute block we can do that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input dob : date9. age;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format dob date9.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;21Jan1988 25&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc report data=test headline headskip missing nowd;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; column dob age dob_age;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; define dob / display;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; define age / display;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; define dob_age / computed;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; compute dob_age / character length=100;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dob_age=put(dob,date9.)||'('||strip(put(age,3.))||')';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; endcomp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jan 2013 14:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117217#M10294</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2013-01-07T14:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating date variable with numeric variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117218#M10295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;input month $ sale;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;jan 2000&lt;/P&gt;&lt;P&gt;feb 1400&lt;/P&gt;&lt;P&gt;mar 2300&lt;/P&gt;&lt;P&gt;apr 3400&lt;/P&gt;&lt;P&gt;may 2700&lt;/P&gt;&lt;P&gt;jun 3200&lt;/P&gt;&lt;P&gt;july 800&lt;/P&gt;&lt;P&gt;aug 2900&lt;/P&gt;&lt;P&gt;sep 1700&lt;/P&gt;&lt;P&gt;oct 2100&lt;/P&gt;&lt;P&gt;nov 2600&lt;/P&gt;&lt;P&gt;dec 3200&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i m looking to convert month in num as 1 2 3 ,&lt;/P&gt;&lt;P&gt;for that i m tring it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test1;&lt;/P&gt;&lt;P&gt;set test;&lt;/P&gt;&lt;P&gt;mon_num=input(month,monname3.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc print; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but its showing error. i need to short data by month. can we do it in short or sud i use if condition on each month????&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Jan 2013 18:07:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117218#M10295</guid>
      <dc:creator>Aman4SAS</dc:creator>
      <dc:date>2013-01-26T18:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating date variable with numeric variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117219#M10296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not even a picture format can present two values in one PUT()&lt;/P&gt;&lt;P&gt;it needs a concatenation .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why is it important to have two values in one cell?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Jan 2013 19:25:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenating-date-variable-with-numeric-variable/m-p/117219#M10296</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-01-26T19:25:01Z</dc:date>
    </item>
  </channel>
</rss>

