<?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: SAS - notes regarding type conversion - how to fix in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SAS-notes-regarding-type-conversion-how-to-fix/m-p/519547#M3824</link>
    <description>&lt;P&gt;You need be more careful in what variables you are referencing.&lt;/P&gt;
&lt;P&gt;Take this little block of code:&lt;/P&gt;
&lt;PRE&gt;271      ** Create new variable that contains numeric values of s_cmstdtc;
272      ** If the first character of s_cmstdtc is 'U', leave numeric value missing;
273
274      format sort date9.;
275      sort = input(s_cmstdtc, ??date9.);
276      if upcase(substrn(sort,1,1))= "U" then sort = .;&lt;/PRE&gt;
&lt;P&gt;You convert the characters in S_CMSTDTC into a date value in SORT.&amp;nbsp; But then try to use a character function on the numeric variable SORT.&amp;nbsp; Didn't you mean to check S_CMSTDTC?&amp;nbsp; Also shouldn't you check it BEFORE trying to convert it to a date?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But even easier just delete the last line since the assignment statement above it will have already converted strings that are not valid dates (including strings that start with the letter U) to missing values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also look at this block of code earlier&lt;/P&gt;
&lt;PRE&gt;263      ** Create new variable for s_cmtrt;
264      if (s_cmtrt ne ' ') then medname = Medication;
265      else if (s_cmtrt eq ' ') then Medication = 'None';
&lt;/PRE&gt;
&lt;P&gt;The comment mentions only one input variable, but the IF statement is reading from some other variable named MEDICATION.&amp;nbsp; Then the ELSE statement will modify that MEDICATION variable, but do nothing with the MEDNAME variable.&amp;nbsp; Did you mean to change the MEDICATION variable?&amp;nbsp; Did you mean to not set the MEDNAME variable to anything?&amp;nbsp; Is it a new variable or an existing variable that is being read in from the source dataset?&lt;/P&gt;</description>
    <pubDate>Fri, 07 Dec 2018 20:36:41 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-12-07T20:36:41Z</dc:date>
    <item>
      <title>SAS - notes regarding type conversion - how to fix</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-notes-regarding-type-conversion-how-to-fix/m-p/519277#M3751</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was wondering if anyone can help with my code. I'm new to coding so I apologize if this is a dump question. I keep getting the following notes in my code and I'm not sure how to fix it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;250&amp;nbsp; data merged(drop=prefname s_cmtrt s_cmindsp s_cmindc s_cmstdtc s_cmenrf s_cmendtc s_cmany medname scrfail);&lt;BR /&gt;251&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge studyrx(in=studyrx&lt;BR /&gt;252&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where= (SCRFAIL ne 'YES'))&lt;BR /&gt;253&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x_cm(in=x_cm);&lt;BR /&gt;254&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by s_siteid s_subjid;&lt;BR /&gt;255&lt;BR /&gt;256&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length end $9;&lt;BR /&gt;257&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label start = "Start(ddMMMyyyy)"&lt;BR /&gt;258&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end = "End(ddMMMyyyy)";&lt;BR /&gt;259&lt;BR /&gt;260&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ** Concatenate prefname and s_cmtrt in parentheses;&lt;BR /&gt;261&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Medication= trim(compress(prefname) || '(' || trim(compress(s_cmtrt)) || ')');&lt;BR /&gt;262&lt;BR /&gt;263&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ** Create new variable for s_cmtrt;&lt;BR /&gt;264&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (s_cmtrt ne ' ') then medname = Medication;&lt;BR /&gt;265&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (s_cmtrt eq ' ') then Medication = 'None';&lt;BR /&gt;266&lt;BR /&gt;267&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ** Create new variable for s_cmindsp where missing equals s_cmindc;&lt;BR /&gt;268&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (s_cmindsp ne ' ') then Indication = s_cmindsp;&lt;BR /&gt;269&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (s_cmindsp eq ' ') then Indication = s_cmindc;&lt;BR /&gt;270&lt;BR /&gt;271&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ** Create new variable that contains numeric values of s_cmstdtc;&lt;BR /&gt;272&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ** If the first character of s_cmstdtc is 'U', leave numeric value missing;&lt;BR /&gt;273&lt;BR /&gt;274&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format sort date9.;&lt;BR /&gt;275&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sort = input(s_cmstdtc, ??date9.);&lt;BR /&gt;276&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if upcase(substrn(sort,1,1))= "U" then sort = .;&lt;BR /&gt;277&lt;BR /&gt;278&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if substr(start,1,1)eq 'U' then start = 'Unknown';&lt;BR /&gt;279&lt;BR /&gt;280&lt;BR /&gt;281&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ** When s_cmenrf is "ONGOING" and s_cmendtc is missing, display the "ONGOING" value;&lt;BR /&gt;282&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (s_cmenrf eq 'ONGOING' and s_cmendtc eq ' ') then end = 'ONGOING';&lt;BR /&gt;283&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else end = s_cmendtc;&lt;BR /&gt;284&lt;BR /&gt;285&amp;nbsp; run;&lt;/DIV&gt;
&lt;DIV&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 278:15&lt;BR /&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 278:45&lt;BR /&gt;NOTE: There were 77 observations read from the data set WORK.STUDYRX.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE SCRFAIL not = 'YES';&lt;BR /&gt;NOTE: There were 300 observations read from the data set WORK.X_CM.&lt;BR /&gt;NOTE: The data set WORK.MERGED has 313 observations and 10 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.09 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.04 seconds&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Thank you!&lt;/DIV&gt;</description>
      <pubDate>Thu, 06 Dec 2018 21:06:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-notes-regarding-type-conversion-how-to-fix/m-p/519277#M3751</guid>
      <dc:creator>Patelbb</dc:creator>
      <dc:date>2018-12-06T21:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code Help</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-notes-regarding-type-conversion-how-to-fix/m-p/519278#M3752</link>
      <description>&lt;P&gt;Is the variable START numeric? Because the way your code is written, it must be character; if it really is numeric then that would explain the NOTEs in the LOG.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 20:48:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-notes-regarding-type-conversion-how-to-fix/m-p/519278#M3752</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-12-06T20:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code Help</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-notes-regarding-type-conversion-how-to-fix/m-p/519282#M3753</link>
      <description>&lt;P&gt;How is this different than your question yesterday? It's literally the exact same notes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Coding-Help/m-p/518938" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Coding-Help/m-p/518938&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 21:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-notes-regarding-type-conversion-how-to-fix/m-p/519282#M3753</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-06T21:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS - notes regarding type conversion - how to fix</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-notes-regarding-type-conversion-how-to-fix/m-p/519547#M3824</link>
      <description>&lt;P&gt;You need be more careful in what variables you are referencing.&lt;/P&gt;
&lt;P&gt;Take this little block of code:&lt;/P&gt;
&lt;PRE&gt;271      ** Create new variable that contains numeric values of s_cmstdtc;
272      ** If the first character of s_cmstdtc is 'U', leave numeric value missing;
273
274      format sort date9.;
275      sort = input(s_cmstdtc, ??date9.);
276      if upcase(substrn(sort,1,1))= "U" then sort = .;&lt;/PRE&gt;
&lt;P&gt;You convert the characters in S_CMSTDTC into a date value in SORT.&amp;nbsp; But then try to use a character function on the numeric variable SORT.&amp;nbsp; Didn't you mean to check S_CMSTDTC?&amp;nbsp; Also shouldn't you check it BEFORE trying to convert it to a date?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But even easier just delete the last line since the assignment statement above it will have already converted strings that are not valid dates (including strings that start with the letter U) to missing values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also look at this block of code earlier&lt;/P&gt;
&lt;PRE&gt;263      ** Create new variable for s_cmtrt;
264      if (s_cmtrt ne ' ') then medname = Medication;
265      else if (s_cmtrt eq ' ') then Medication = 'None';
&lt;/PRE&gt;
&lt;P&gt;The comment mentions only one input variable, but the IF statement is reading from some other variable named MEDICATION.&amp;nbsp; Then the ELSE statement will modify that MEDICATION variable, but do nothing with the MEDNAME variable.&amp;nbsp; Did you mean to change the MEDICATION variable?&amp;nbsp; Did you mean to not set the MEDNAME variable to anything?&amp;nbsp; Is it a new variable or an existing variable that is being read in from the source dataset?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 20:36:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-notes-regarding-type-conversion-how-to-fix/m-p/519547#M3824</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-12-07T20:36:41Z</dc:date>
    </item>
  </channel>
</rss>

