<?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: Odd Behavior - SAS hangs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Odd-Behavior-SAS-hangs/m-p/66388#M14410</link>
    <description>Hi:&lt;BR /&gt;
  I see a few issues in your code:&lt;BR /&gt;
1) no semicolon after the comment (which I assumed was a copying typo when you posted it in your previous entry):&lt;BR /&gt;
Incorrect: [pre]&lt;BR /&gt;
%let dataview = 'TIMD.v_Feed_Results_INT'; ** Internal/External data view&lt;BR /&gt;
%let test = 43271; ** change test number&lt;BR /&gt;
%let num_anml = 25; ** change number of animals&lt;BR /&gt;
[/pre] &lt;BR /&gt;
             &lt;BR /&gt;
Correct:[pre]&lt;BR /&gt;
%let dataview = 'TIMD.v_Feed_Results_INT'; ** Internal/External data view;&lt;BR /&gt;
%let test = 43271; ** change test number;&lt;BR /&gt;
%let num_anml = 25; ** change number of animals;&lt;BR /&gt;
            &lt;BR /&gt;
OR&lt;BR /&gt;
%let dataview = 'TIMD.v_Feed_Results_INT';  /* Internal/External data view*/&lt;BR /&gt;
%let test = 43271;  /* change test number */&lt;BR /&gt;
%let num_anml = 25;  /* change number of animals*/&lt;BR /&gt;
[/pre] &lt;BR /&gt;
 &lt;BR /&gt;
A SAS comment starts with an asterisk and ends with a semi-colon OR is anything enclosed in  /* ... */  which also can be used to provide comments.&lt;BR /&gt;
If you really did have the code as you showed it, without a semicolon, then you would effectively be "ruining" the subsequent statements. the final comment, "**change number of animals" would be unclosed and so whatever is in the other code steps after that comment could be messed up, which might lead to quoting problems or step boundary problems.&lt;BR /&gt;
&lt;BR /&gt;
2) it is NOT appropriate to refer to a SAS dataset inside a quoted string. Generally, it's not a good idea to "prequote" macro variables anyway. You can prove this to yourself by submitting the following code:&lt;BR /&gt;
[pre]&lt;BR /&gt;
title '1) use sas name without quotes';&lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select * &lt;BR /&gt;
  from sashelp.class&lt;BR /&gt;
quit;&lt;BR /&gt;
                           &lt;BR /&gt;
title '2) use operating system filename and file extension';&lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select * &lt;BR /&gt;
  from 'c:\temp\class.sas7bdat';&lt;BR /&gt;
quit;&lt;BR /&gt;
                         &lt;BR /&gt;
title '3) use quotes around sas name';&lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select * &lt;BR /&gt;
  from "sashelp.class";&lt;BR /&gt;
quit;&lt;BR /&gt;
                         &lt;BR /&gt;
title '4) use macro variable reference correctly';&lt;BR /&gt;
%let indata = sashelp.class;&lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select * &lt;BR /&gt;
  from &amp;amp;indata;&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
You will see output from steps 1, 2 and 4. #4 example shows the correct way to use a macro variable reference (unquoted) to provide a SAS data set name.&lt;BR /&gt;
&lt;BR /&gt;
 #3 example code (which is the equivalent of what your macro is doing) will get you this ERROR in the LOG:&lt;BR /&gt;
[pre]&lt;BR /&gt;
3991  title '3) use quotes around sas name';&lt;BR /&gt;
3992  ods listing;&lt;BR /&gt;
3993  proc sql;&lt;BR /&gt;
3994    select *&lt;BR /&gt;
3995    from "sashelp.class";&lt;BR /&gt;
ERROR: Extension for physical file name "sashelp.class" does not correspond to a valid member type.&lt;BR /&gt;
3996  quit;&lt;BR /&gt;
                            &lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                   &lt;BR /&gt;
I suspect that the reason you're not seeing anything in the SAS log and the reason that SAS is hanging is that your session is either lost in "quote-land" or "mismatched comment land" and the only thing to do at this point is SAVE your work, if you can, close SAS and start over again. Submit your code in smaller chunks and review the SAS LOG after EVERY little chunk until you hit the first error message or place where SAS stops working. Then look at the code immediately above that location and search for mismatched quotes, inappropriate macro variable references, mismatched opening and closing comments, missing semi-colons, etc etc.&lt;BR /&gt;
 &lt;BR /&gt;
If you continue to have issues, since it appears that you have lengthy code, which may or may not involve SAS macro programs, you might want to work with Tech Support, as they can look at ALL of your code and help you find the problem. One of the things about SAS error messages is that the place where an error message finally appears may not be related to the place where the error first occurred in your code. So something could have gone wrong in the place where you have "other code steps...".&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
    <pubDate>Wed, 17 Dec 2008 20:03:43 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2008-12-17T20:03:43Z</dc:date>
    <item>
      <title>Odd Behavior - SAS hangs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Odd-Behavior-SAS-hangs/m-p/66387#M14409</link>
      <description>I wrote earlier today regarding an issue with an invalid statements in a 'proc sql'.&lt;BR /&gt;
I tried to work around it using a macro - dataview.&lt;BR /&gt;
The code below works but the Log output is blank and SAS hangs. The original proc is at the very bottom below.&lt;BR /&gt;
Another question - Is there a way to format code so that is doesn't slam against the left margin?&lt;BR /&gt;
..&lt;BR /&gt;
..&lt;BR /&gt;
%let dataview = 'TIMD.v_Feed_Results_INT';   ** Internal/External data view&lt;BR /&gt;
%let test = 43271;                           ** change test number&lt;BR /&gt;
%let num_anml = 25;                          ** change number of animals&lt;BR /&gt;
&lt;BR /&gt;
other code steps .....&lt;BR /&gt;
.....&lt;BR /&gt;
....&lt;BR /&gt;
....&lt;BR /&gt;
..... New Step - runs to completion and correct results are in the database,&lt;BR /&gt;
..... but Log Output is blank&lt;BR /&gt;
.....  and SAS hangs - have to use Task Manager to "kill" it.&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create view datavalv as&lt;BR /&gt;
  select Data_Validity_Code,&lt;BR /&gt;
         SAK_Feeding_Test_Res &lt;BR /&gt;
  from &amp;amp;dataview&lt;BR /&gt;
  where test_num = &amp;amp;test;&lt;BR /&gt;
  quit;&lt;BR /&gt;
&lt;BR /&gt;
..... Original step&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create view datavalv as&lt;BR /&gt;
  select Data_Validity_Code,&lt;BR /&gt;
         SAK_Feeding_Test_Res &lt;BR /&gt;
  from TIMD.v_Feed_Results_INT&lt;BR /&gt;
  where test_num = &amp;amp;test;&lt;BR /&gt;
  quit;</description>
      <pubDate>Wed, 17 Dec 2008 18:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Odd-Behavior-SAS-hangs/m-p/66387#M14409</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-12-17T18:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Odd Behavior - SAS hangs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Odd-Behavior-SAS-hangs/m-p/66388#M14410</link>
      <description>Hi:&lt;BR /&gt;
  I see a few issues in your code:&lt;BR /&gt;
1) no semicolon after the comment (which I assumed was a copying typo when you posted it in your previous entry):&lt;BR /&gt;
Incorrect: [pre]&lt;BR /&gt;
%let dataview = 'TIMD.v_Feed_Results_INT'; ** Internal/External data view&lt;BR /&gt;
%let test = 43271; ** change test number&lt;BR /&gt;
%let num_anml = 25; ** change number of animals&lt;BR /&gt;
[/pre] &lt;BR /&gt;
             &lt;BR /&gt;
Correct:[pre]&lt;BR /&gt;
%let dataview = 'TIMD.v_Feed_Results_INT'; ** Internal/External data view;&lt;BR /&gt;
%let test = 43271; ** change test number;&lt;BR /&gt;
%let num_anml = 25; ** change number of animals;&lt;BR /&gt;
            &lt;BR /&gt;
OR&lt;BR /&gt;
%let dataview = 'TIMD.v_Feed_Results_INT';  /* Internal/External data view*/&lt;BR /&gt;
%let test = 43271;  /* change test number */&lt;BR /&gt;
%let num_anml = 25;  /* change number of animals*/&lt;BR /&gt;
[/pre] &lt;BR /&gt;
 &lt;BR /&gt;
A SAS comment starts with an asterisk and ends with a semi-colon OR is anything enclosed in  /* ... */  which also can be used to provide comments.&lt;BR /&gt;
If you really did have the code as you showed it, without a semicolon, then you would effectively be "ruining" the subsequent statements. the final comment, "**change number of animals" would be unclosed and so whatever is in the other code steps after that comment could be messed up, which might lead to quoting problems or step boundary problems.&lt;BR /&gt;
&lt;BR /&gt;
2) it is NOT appropriate to refer to a SAS dataset inside a quoted string. Generally, it's not a good idea to "prequote" macro variables anyway. You can prove this to yourself by submitting the following code:&lt;BR /&gt;
[pre]&lt;BR /&gt;
title '1) use sas name without quotes';&lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select * &lt;BR /&gt;
  from sashelp.class&lt;BR /&gt;
quit;&lt;BR /&gt;
                           &lt;BR /&gt;
title '2) use operating system filename and file extension';&lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select * &lt;BR /&gt;
  from 'c:\temp\class.sas7bdat';&lt;BR /&gt;
quit;&lt;BR /&gt;
                         &lt;BR /&gt;
title '3) use quotes around sas name';&lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select * &lt;BR /&gt;
  from "sashelp.class";&lt;BR /&gt;
quit;&lt;BR /&gt;
                         &lt;BR /&gt;
title '4) use macro variable reference correctly';&lt;BR /&gt;
%let indata = sashelp.class;&lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select * &lt;BR /&gt;
  from &amp;amp;indata;&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
You will see output from steps 1, 2 and 4. #4 example shows the correct way to use a macro variable reference (unquoted) to provide a SAS data set name.&lt;BR /&gt;
&lt;BR /&gt;
 #3 example code (which is the equivalent of what your macro is doing) will get you this ERROR in the LOG:&lt;BR /&gt;
[pre]&lt;BR /&gt;
3991  title '3) use quotes around sas name';&lt;BR /&gt;
3992  ods listing;&lt;BR /&gt;
3993  proc sql;&lt;BR /&gt;
3994    select *&lt;BR /&gt;
3995    from "sashelp.class";&lt;BR /&gt;
ERROR: Extension for physical file name "sashelp.class" does not correspond to a valid member type.&lt;BR /&gt;
3996  quit;&lt;BR /&gt;
                            &lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                   &lt;BR /&gt;
I suspect that the reason you're not seeing anything in the SAS log and the reason that SAS is hanging is that your session is either lost in "quote-land" or "mismatched comment land" and the only thing to do at this point is SAVE your work, if you can, close SAS and start over again. Submit your code in smaller chunks and review the SAS LOG after EVERY little chunk until you hit the first error message or place where SAS stops working. Then look at the code immediately above that location and search for mismatched quotes, inappropriate macro variable references, mismatched opening and closing comments, missing semi-colons, etc etc.&lt;BR /&gt;
 &lt;BR /&gt;
If you continue to have issues, since it appears that you have lengthy code, which may or may not involve SAS macro programs, you might want to work with Tech Support, as they can look at ALL of your code and help you find the problem. One of the things about SAS error messages is that the place where an error message finally appears may not be related to the place where the error first occurred in your code. So something could have gone wrong in the place where you have "other code steps...".&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 17 Dec 2008 20:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Odd-Behavior-SAS-hangs/m-p/66388#M14410</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-12-17T20:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Odd Behavior - SAS hangs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Odd-Behavior-SAS-hangs/m-p/66389#M14411</link>
      <description>Here is first chunk of code (how do I get the pasted code to maintain indent):&lt;BR /&gt;
&lt;BR /&gt;
    %let dataview = 'TIMD.v_Feed_Results_INT';   ** Internal/External data view                   **;&lt;BR /&gt;
    %let test = 43271;                      ** change test number                            **;&lt;BR /&gt;
    %let num_anml = 25;                     ** change number of animals                      **;&lt;BR /&gt;
&lt;BR /&gt;
The problem is in this chunk of code:&lt;BR /&gt;
&lt;BR /&gt;
   ******************************************;&lt;BR /&gt;
   ** access data validity information **;&lt;BR /&gt;
   ******************************************;&lt;BR /&gt;
   proc sql;&lt;BR /&gt;
     create view datavalv as&lt;BR /&gt;
     select Data_Validity_Code,&lt;BR /&gt;
            SAK_Feeding_Test_Res &lt;BR /&gt;
     from &amp;amp;dataview&lt;BR /&gt;
     where test_num = &amp;amp;test;&lt;BR /&gt;
     quit;&lt;BR /&gt;
&lt;BR /&gt;
If I change this one line from:&lt;BR /&gt;
&lt;BR /&gt;
     from &amp;amp;dataview&lt;BR /&gt;
&lt;BR /&gt;
to&lt;BR /&gt;
&lt;BR /&gt;
     from TIMD.v_Feed_Results_INT&lt;BR /&gt;
&lt;BR /&gt;
The code runs fine, the Output pane is populated and SAS does not hang.&lt;BR /&gt;
&lt;BR /&gt;
Another oddity is that even though SAS hangs, it does perform the very last step which is a "proc dbload'  that inserts the results to a table on Oracle.</description>
      <pubDate>Wed, 17 Dec 2008 21:31:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Odd-Behavior-SAS-hangs/m-p/66389#M14411</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-12-17T21:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Odd Behavior - SAS hangs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Odd-Behavior-SAS-hangs/m-p/66390#M14412</link>
      <description>As Cynthia wrote already: Get rid of the quotes!&lt;BR /&gt;
&lt;BR /&gt;
The way you do it your macro var &amp;amp;dataview resolves to the quoted string 'TIMD.v_Feed_Results_INT' and not to the unquoted string you're using: TIMD.v_Feed_Results_INT - you're therefore comparing apples with oranges.&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Thu, 18 Dec 2008 05:20:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Odd-Behavior-SAS-hangs/m-p/66390#M14412</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2008-12-18T05:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Odd Behavior - SAS hangs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Odd-Behavior-SAS-hangs/m-p/66391#M14413</link>
      <description>Rather that fight with SAS I decided to create a PL/SQL view in the database that handles the difference between internal and external tests.&lt;BR /&gt;
&lt;BR /&gt;
Worked the first time without all the hassels of SAS code.&lt;BR /&gt;
&lt;BR /&gt;
Thanks Cynthia &amp;amp; Patrick for you assistance.</description>
      <pubDate>Thu, 18 Dec 2008 16:51:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Odd-Behavior-SAS-hangs/m-p/66391#M14413</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-12-18T16:51:25Z</dc:date>
    </item>
  </channel>
</rss>

