<?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: Creating a categorical variable from Date9. variable in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816433#M34313</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/386127"&gt;@scolitti1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Tried this too, and get the same issue. Taken from my log:&lt;/P&gt;
&lt;P&gt;NOTE: Invalid numeric data, Yr_week='wk ..' , at line 118 column 4.&lt;BR /&gt;WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's just a part of the log. We need to see the code in the log and a few of the messages afterwards&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jun 2022 20:37:40 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-06-03T20:37:40Z</dc:date>
    <item>
      <title>Creating a categorical variable from Date9. variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816395#M34306</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a new variable called yr_week, which will display as "2022wk01", "2022wk02", "2022wk03", and so on.. I am trying to create the variable from Hospital_Date_Admit which is in the date9. format. Yr_week time period is Sunday to following Saturday.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have modified code used to create this variable in another dataset shown below:&lt;/P&gt;&lt;P&gt;Yr_week = catx("wk", Hospital_Date_Admit);&lt;BR /&gt;if yr_week eq '.wk.' then yr_week=year(Hospital_Date_Admit);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue I am coming across is the output is that the format is not what I want. For example:&lt;/P&gt;&lt;P&gt;Hospital_Date_Admit = 13MAY2020 and the corresponding yr_week = 22048.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to change the "22048" to show "2020wk20".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV align="center"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 Jun 2022 19:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816395#M34306</guid>
      <dc:creator>scolitti1</dc:creator>
      <dc:date>2022-06-03T19:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a categorical variable from Date9. variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816400#M34307</link>
      <description>&lt;P&gt;Use on of the YYWEEK formats for your&amp;nbsp;&lt;SPAN&gt;Hospital_Date_Admit variable, and statistical procedures will use the formatted value to build groups.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 19:23:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816400#M34307</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-06-03T19:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a categorical variable from Date9. variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816413#M34308</link>
      <description>&lt;P&gt;Thanks, I tried that but my code stopped processing due to too many errors.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 19:56:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816413#M34308</guid>
      <dc:creator>scolitti1</dc:creator>
      <dc:date>2022-06-03T19:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a categorical variable from Date9. variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816421#M34309</link>
      <description>&lt;P&gt;The CAT...() functions use the actual value, not the formatted value.&amp;nbsp; If you want to use a formatted value with those functions then use the PUT() function to apply the format.&amp;nbsp; You can try using the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n1ka2ulrvrjlasn0z7beco2yrgas.htm" target="_self"&gt;WEEK() function&lt;/A&gt; to calculate the week number part.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* 2022wk01 ;
length Yr_week $8 ;
yr_week = catx(year(Hospital_Date_Admit),"wk",put(week(Hospital_Date_Admit),z2.));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Jun 2022 20:33:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816421#M34309</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-03T20:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a categorical variable from Date9. variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816426#M34310</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/386127"&gt;@scolitti1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks, I tried that but my code stopped processing due to too many errors.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then you did something wrong. Show us the log for your data step.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 20:36:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816426#M34310</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-03T20:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a categorical variable from Date9. variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816427#M34311</link>
      <description>&lt;P&gt;Tried this too, and get the same issue. Taken from my log:&lt;/P&gt;&lt;P&gt;NOTE: Invalid numeric data, Yr_week='wk ..' , at line 118 column 4.&lt;BR /&gt;WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 20:31:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816427#M34311</guid>
      <dc:creator>scolitti1</dc:creator>
      <dc:date>2022-06-03T20:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a categorical variable from Date9. variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816431#M34312</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/386127"&gt;@scolitti1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Tried this too, and get the same issue. Taken from my log:&lt;/P&gt;
&lt;P&gt;NOTE: Invalid numeric data, Yr_week='wk ..' , at line 118 column 4.&lt;BR /&gt;WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You cannot change the TYPE of an existing variable.&amp;nbsp; Use a name for the NEW variable that has not been used already.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hospital_Date_Admit must be a NUMERIC variable with DATE values (number of days since 1960).&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 20:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816431#M34312</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-03T20:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a categorical variable from Date9. variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816433#M34313</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/386127"&gt;@scolitti1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Tried this too, and get the same issue. Taken from my log:&lt;/P&gt;
&lt;P&gt;NOTE: Invalid numeric data, Yr_week='wk ..' , at line 118 column 4.&lt;BR /&gt;WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's just a part of the log. We need to see the code in the log and a few of the messages afterwards&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 20:37:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816433#M34313</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-03T20:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a categorical variable from Date9. variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816435#M34314</link>
      <description>&lt;P&gt;Below is my entire log for the data step:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;115 data crm2;&lt;BR /&gt;116 set crm.RE_CHESS_IRIS_CRM;&lt;BR /&gt;117 Yr_week = catx(year(Hospital_Date_Admit),"wk",put(week(Hospital_Date_Admit),z2.));&lt;BR /&gt;118 if yr_week=. then delete;&lt;BR /&gt;119 run;&lt;/P&gt;&lt;P&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;BR /&gt;117:16&lt;BR /&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;BR /&gt;118:4&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202140' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=No vcmr_id=40697631 Hospital_Date_Admit=05OCT2021 latino=1&lt;BR /&gt;Yr_week=wk 202140 _ERROR_=1 _N_=1&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202107' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=&lt;BR /&gt;Currently_Hospitalized=Yes vcmr_id=22590559 Hospital_Date_Admit=18FEB2021 latino=1&lt;BR /&gt;Yr_week=wk 202107 _ERROR_=1 _N_=2&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202148' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Unknown RacEth_Long=Unknown Ever_Been_Hospitalized=Yes Currently_Hospitalized=Yes&lt;BR /&gt;vcmr_id=49261540 Hospital_Date_Admit=02DEC2021 latino=. Yr_week=wk 202148 _ERROR_=1 _N_=3&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202137' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=No&lt;BR /&gt;Currently_Hospitalized=Yes vcmr_id=39214839 Hospital_Date_Admit=13SEP2021 latino=1&lt;BR /&gt;Yr_week=wk 202137 _ERROR_=1 _N_=4&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202145' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=No vcmr_id=45548672 Hospital_Date_Admit=07NOV2021 latino=1&lt;BR /&gt;Yr_week=wk 202145 _ERROR_=1 _N_=5&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk ..' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=No vcmr_id=21387771 Hospital_Date_Admit=. latino=1 Yr_week=wk ..&lt;BR /&gt;_ERROR_=1 _N_=6&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202104' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Unknown RacEth_Long=Unknown Ever_Been_Hospitalized=Yes Currently_Hospitalized=&lt;BR /&gt;vcmr_id=21334183 Hospital_Date_Admit=29JAN2021 latino=. Yr_week=wk 202104 _ERROR_=1 _N_=7&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202102' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=Yes vcmr_id=19394438 Hospital_Date_Admit=10JAN2021 latino=1&lt;BR /&gt;Yr_week=wk 202102 _ERROR_=1 _N_=8&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202131' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=Yes vcmr_id=32349578 Hospital_Date_Admit=07AUG2021 latino=1&lt;BR /&gt;Yr_week=wk 202131 _ERROR_=1 _N_=9&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202132' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Black or African American, Not Hispanic&lt;BR /&gt;RacEth_Long=Black or African American, Not Hispanic Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=Yes vcmr_id=32533585 Hospital_Date_Admit=08AUG2021 latino=.&lt;BR /&gt;Yr_week=wk 202132 _ERROR_=1 _N_=10&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202148' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=Yes vcmr_id=49275954 Hospital_Date_Admit=03DEC2021 latino=1&lt;BR /&gt;Yr_week=wk 202148 _ERROR_=1 _N_=11&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk ..' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=No vcmr_id=46910062 Hospital_Date_Admit=. latino=1 Yr_week=wk ..&lt;BR /&gt;_ERROR_=1 _N_=12&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202105' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=No vcmr_id=21815477 Hospital_Date_Admit=03FEB2021 latino=1&lt;BR /&gt;Yr_week=wk 202105 _ERROR_=1 _N_=13&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk ..' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=Yes vcmr_id=49400706 Hospital_Date_Admit=. latino=1 Yr_week=wk ..&lt;BR /&gt;_ERROR_=1 _N_=14&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202114' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Black or African American, Not Hispanic&lt;BR /&gt;RacEth_Long=Black or African American, Not Hispanic Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=Yes vcmr_id=25341392 Hospital_Date_Admit=05APR2021 latino=.&lt;BR /&gt;Yr_week=wk 202114 _ERROR_=1 _N_=15&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk ..' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized= vcmr_id=48605525 Hospital_Date_Admit=. latino=1 Yr_week=wk ..&lt;BR /&gt;_ERROR_=1 _N_=16&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202104' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Unknown RacEth_Long=Unknown Ever_Been_Hospitalized=Yes Currently_Hospitalized=Yes&lt;BR /&gt;vcmr_id=21361452 Hospital_Date_Admit=27JAN2021 latino=. Yr_week=wk 202104 _ERROR_=1 _N_=17&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202105' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Asian, Not Hispanic RacEth_Long=Asian, Not Hispanic Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=Yes vcmr_id=21544880 Hospital_Date_Admit=31JAN2021 latino=.&lt;BR /&gt;Yr_week=wk 202105 _ERROR_=1 _N_=18&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk 202105' , at line 118 column 4.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=Yes vcmr_id=21544900 Hospital_Date_Admit=31JAN2021 latino=1&lt;BR /&gt;Yr_week=wk 202105 _ERROR_=1 _N_=19&lt;BR /&gt;NOTE: Invalid numeric data, Yr_week='wk ..' , at line 118 column 4.&lt;BR /&gt;WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed.&lt;BR /&gt;RacEth_Short=Hispanic/Latinx RacEth_Long=Hispanic/Latinx Ever_Been_Hospitalized=Yes&lt;BR /&gt;Currently_Hospitalized=Yes vcmr_id=52022618 Hospital_Date_Admit=. latino=1 Yr_week=wk ..&lt;BR /&gt;_ERROR_=1 _N_=20&lt;BR /&gt;NOTE: Missing values were generated as a result of performing an operation on missing values.&lt;BR /&gt;Each place is given by: (Number of times) at (Line):(Column).&lt;BR /&gt;1788 at 117:16 1788 at 117:51&lt;BR /&gt;NOTE: There were 7374 observations read from the data set CRM.RE_CHESS_IRIS_CRM.&lt;BR /&gt;NOTE: The data set WORK.CRM2 has 0 observations and 8 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.07 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 20:38:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816435#M34314</guid>
      <dc:creator>scolitti1</dc:creator>
      <dc:date>2022-06-03T20:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a categorical variable from Date9. variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816436#M34315</link>
      <description>&lt;P&gt;First, you see&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;NOTE: Invalid numeric data, Yr_week='wk 202140' , at line 118 column 4.&lt;/PRE&gt;
&lt;P&gt;so let's look at line 118&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;118 if yr_week=. then delete;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The variable named YR_WEEK is not numeric. It is character. So you cannot test to see if it is equal to &lt;FONT face="courier new,courier"&gt;.&lt;/FONT&gt; so you have to test to see if it is equal to a character missing, which is &lt;FONT face="courier new,courier"&gt;' '&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Of course, the suggestion to use the YYWEEK format is a better one, in my opinion.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 20:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816436#M34315</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-03T20:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a categorical variable from Date9. variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816440#M34316</link>
      <description>&lt;P&gt;CATX() was the wrong function or the arguments are in the wrong order.&amp;nbsp; You could use CATS() instead.&lt;/P&gt;
&lt;P&gt;Do not compare YR_WEEK to a numeric missing value.&amp;nbsp; That will cause SAS to try to convert the strings in YR_WEEK into numbers.&amp;nbsp; YR_WEEK should not be missing anyway.&amp;nbsp; It will have 'wk' or '.wk.'.&amp;nbsp; Instead test if the actual date is missing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  if missing(Hospital_Date_Admit) then delete;
  length yr_week $8;
  Yr_week = cats(year(Hospital_Date_Admit),"wk",put(week(Hospital_Date_Admit),z2.));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 20:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816440#M34316</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-03T20:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a categorical variable from Date9. variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816445#M34317</link>
      <description>Thank you!</description>
      <pubDate>Fri, 03 Jun 2022 21:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-categorical-variable-from-Date9-variable/m-p/816445#M34317</guid>
      <dc:creator>scolitti1</dc:creator>
      <dc:date>2022-06-03T21:00:13Z</dc:date>
    </item>
  </channel>
</rss>

