<?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: Missing data when importing data from individual hospitals then aggregating the data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Missing-data-when-importing-data-from-individual-hospitals-then/m-p/913189#M359936</link>
    <description>&lt;P&gt;Is the hospital with the problem name actually in the data set named Filenames? It isn't clear and that sort of data sometimes has problems reading depending on how the file was read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that you need to show the complete value of the variable Basefile for that observation.&lt;/P&gt;
&lt;P&gt;For one thing expect problems if there is no part of the variable that is ANTI .&lt;/P&gt;
&lt;P&gt;You might also show us the LOG from when you run the code. Copy the log including the code and all messages generated by that data step. Then on the forum open a text box using the &amp;lt;/&amp;gt; icon and paste the text. The text box will preserve the formatting of any diagnostic text and sets it apart visually from the discussion text.&lt;/P&gt;</description>
    <pubDate>Sat, 27 Jan 2024 07:51:22 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-01-27T07:51:22Z</dc:date>
    <item>
      <title>Missing data when importing data from individual hospitals then aggregating the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-data-when-importing-data-from-individual-hospitals-then/m-p/913187#M359935</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have several hospital files that have tables that include data about tests performed for organisms and drug combinations such as the number of tests performed and susceptibility percentage.&lt;/P&gt;&lt;P&gt;I use the code below to extract the hospital names into a separate variable in the filename dataset;&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;data filename_hospital;&lt;BR /&gt;set filenames;&lt;BR /&gt;basefile_cap = upcase(basefile);&lt;BR /&gt;HOSPITAL_drop = substr(basefile_cap, 1, (index(basefile_cap, 'ANTI')-1));&lt;BR /&gt;HOSPITAL = compress(HOSPITAL_drop,'_');&lt;BR /&gt;FILENAME = pathname;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;DIV&gt;and the following call executes to call the Gram Negative data transform macros to pass through the filename and hospital parameters from the filename dataset created above;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data _null_;
set filename_hospital;
call execute('%gn_transform(FILENAME='||FILENAME||', HOSPITAL='||HOSPITAL||');');
run;&lt;/CODE&gt;&lt;/PRE&gt;All hospitals' information is extracted except for the "Children's Hospital" which has the data for this hospital but the name of the hospital field is missing.&lt;/DIV&gt;&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 08:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-data-when-importing-data-from-individual-hospitals-then/m-p/913187#M359935</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2024-01-27T08:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Missing data when importing data from individual hospitals then aggregating the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-data-when-importing-data-from-individual-hospitals-then/m-p/913189#M359936</link>
      <description>&lt;P&gt;Is the hospital with the problem name actually in the data set named Filenames? It isn't clear and that sort of data sometimes has problems reading depending on how the file was read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that you need to show the complete value of the variable Basefile for that observation.&lt;/P&gt;
&lt;P&gt;For one thing expect problems if there is no part of the variable that is ANTI .&lt;/P&gt;
&lt;P&gt;You might also show us the LOG from when you run the code. Copy the log including the code and all messages generated by that data step. Then on the forum open a text box using the &amp;lt;/&amp;gt; icon and paste the text. The text box will preserve the formatting of any diagnostic text and sets it apart visually from the discussion text.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 07:51:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-data-when-importing-data-from-individual-hospitals-then/m-p/913189#M359936</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-01-27T07:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Missing data when importing data from individual hospitals then aggregating the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-data-when-importing-data-from-individual-hospitals-then/m-p/913201#M359939</link>
      <description>&lt;P&gt;I cannot tell from the way you worded the question the exact value that is in the variable.&lt;/P&gt;
&lt;P&gt;If you literally have this value in HOSPITAL&lt;/P&gt;
&lt;PRE&gt;Children's Hospital&lt;/PRE&gt;
&lt;P&gt;Then this statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call execute('%gn_transform(FILENAME='||FILENAME||', HOSPITAL='||HOSPITAL||');');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is going to pass the following string to CALL EXECUTE&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%gn_transform(FILENAME=somefilename,HOSPITAL=Children's Hospital);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and that is a problem because the string contains unbalanced quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could try adding macro quoting so that the value at least makes it into the macro call.&amp;nbsp; (Also wrap the macro call in %nrstr() to delay calling the macro until the string is pull back off the stack to begin executing.)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call execute(cats('%nrstr(%gn_transform)(FILENAME=',FILENAME,', HOSPITAL=%nrstr(%bquote(',HOSPITAL,'));')));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which should show line this on the SAS log&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;+ %gn_transform(FILENAME=somefilename,HOSPITAL=%bquote(Children's Hospital));&lt;/PRE&gt;
&lt;P&gt;But that might cause trouble for the macro, depending on how it using the HOSPITAL macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So perhaps it would just be easier to modify the macro to expect the value of HOSPITAL to already include the quotes.&amp;nbsp; Then the calling statement can just look like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call execute(cats('%nrstr(%gn_transform)(FILENAME=',FILENAME,', HOSPITAL=',quote(trim(HOSPITAL)),');'));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And now the SAS log will show this instead:&lt;/P&gt;
&lt;PRE&gt;+ %gn_transform(FILENAME=somefilename,HOSPITAL="Children's Hospital");&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 15:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-data-when-importing-data-from-individual-hospitals-then/m-p/913201#M359939</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-27T15:13:36Z</dc:date>
    </item>
  </channel>
</rss>

