<?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: Read Access Violation SGPANEL and stack underflow error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-Access-Violation-SGPANEL-and-stack-underflow-error/m-p/747996#M234866</link>
    <description>&lt;P&gt;How many columns do you have?&amp;nbsp; We could try a couple of "quick and dirty" methods.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;To just remove just any stray new line characters, we could apply the below SAS code in a data step to each variable.&amp;nbsp; I'm using "Var" here to represent the columns in your table.&amp;nbsp; You'd have to use the real column names which, if there aren't too many, shouldn't be too tedious.&amp;nbsp; This is fairly safe code because SAS shouldn't treat actual line terminators (&lt;STRONG&gt;assuming you're on Windows)&amp;nbsp;&lt;/STRONG&gt;which are '0D0A'x together.&amp;nbsp; If you're on Linux/Unix, this might not work.&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Var = compress(Var, '0A'x);&lt;/CODE&gt;&lt;/PRE&gt;
&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;If that doesn't work, we could modify the compress like the below.&amp;nbsp; "kw" means "keep writable."&amp;nbsp; When used with COMPRESS, SAS will delete all the non-display/non-writeable characters and keep only the displayable/writeable characters.&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Make a backup copy of your data first&lt;/STRONG&gt; or write to a new dataset.&amp;nbsp; This could have unexpected results depending on what your encoding is and what was in the database and how it was trans-coded.&amp;nbsp; Most likely it will work fine.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Var = compress(Var, , 'kw');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Either of those two methods will remove any extraneous newline characters, and that might be all you need to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
    <pubDate>Tue, 15 Jun 2021 00:45:07 GMT</pubDate>
    <dc:creator>jimbarbour</dc:creator>
    <dc:date>2021-06-15T00:45:07Z</dc:date>
    <item>
      <title>Read Access Violation SGPANEL and stack underflow error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-Access-Violation-SGPANEL-and-stack-underflow-error/m-p/747972#M234852</link>
      <description>&lt;P&gt;Hello! I encountered a weird error while trying to use PROC SGPANEL, error message pasted at the bottom since it's long. The one thread I found on this suggested it might be caused by some strange character, but I don't have any weird characters in my data, there aren't any macros, and I haven't copied/pasted it to a word processor. Here is my code:&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgpanel data=example;
panelby disease;
series x=year y=proportion / group=sortvar;
keylegend / title="Legend Title";
rowaxis label="Year";
colaxis label="Proportion";
format sortvar sortvarf. disease diseasef.;
title "Graph Title";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Example data below. I created the table via some SQL queries, the table looks fine to me but I can share those queries if that would be helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example; 
input year disease sortvar count1 count2 proportion;
datalines;
2010 1 0 64 240 0.267
2010 1 1 6 8 0.750
2010 2 0 171 572 0.299
2010 2 1 89 233 0.382
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you for the help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: An exception has been encountered.&lt;BR /&gt;Please contact technical support and provide them with the following traceback information:&lt;/P&gt;
&lt;P&gt;The SAS task name is [SGPANEL]&lt;BR /&gt;ERROR: Read Access Violation SGPANEL&lt;BR /&gt;Exception occurred at (06882F72)&lt;BR /&gt;Task Traceback&lt;BR /&gt;Address Frame (DBGHELP API Version 4.0 rev 5)&lt;BR /&gt;0000000006882F72 000000003504F560 sasods:tkvercn1+0x181F32&lt;BR /&gt;000000000D329C3A 000000003504F568 sasxml:tkvercn1+0x48BFA&lt;BR /&gt;000000000D30EF48 000000003504FB80 sasxml:tkvercn1+0x2DF08&lt;BR /&gt;0000000006921D0A 000000003504FBC0 sasods:tkvercn1+0x220CCA&lt;BR /&gt;0000000006884769 0000000035050080 sasods:tkvercn1+0x183729&lt;BR /&gt;000000000E1D831A 0000000035050088 sasmrk:tkvercn1+0x1172DA&lt;BR /&gt;000000000E14251E 0000000035050830 sasmrk:tkvercn1+0x814DE&lt;BR /&gt;000000002D6A1BDA 0000000035050838 sasstgr:tkvercn1+0x90B9A&lt;BR /&gt;000000002D61C289 0000000035050A00 sasstgr:tkvercn1+0xB249&lt;BR /&gt;000000002D66A100 0000000035051070 sasstgr:tkvercn1+0x590C0&lt;BR /&gt;0000000008A9C09A 0000000035051078 saswobc:tkvercn1+0x1B05A&lt;BR /&gt;0000000008A8BE65 0000000035051180 saswobc:tkvercn1+0xAE25&lt;BR /&gt;000000002D6A1BDA 00000000350511C0 sasstgr:tkvercn1+0x90B9A&lt;BR /&gt;000000002D627B84 0000000035051240 sasstgr:tkvercn1+0x16B44&lt;BR /&gt;000000002D6A1BDA 0000000035051280 sasstgr:tkvercn1+0x90B9A&lt;BR /&gt;000000002D66A4DF 00000000350518F0 sasstgr:tkvercn1+0x5949F&lt;BR /&gt;0000000008A9C09A 0000000035051930 saswobc:tkvercn1+0x1B05A&lt;BR /&gt;0000000008A8BE65 0000000035051A00 saswobc:tkvercn1+0xAE25&lt;BR /&gt;000000002D6A1BDA 0000000035051A40 sasstgr:tkvercn1+0x90B9A&lt;BR /&gt;000000002D627B84 0000000035051AC0 sasstgr:tkvercn1+0x16B44&lt;BR /&gt;000000002D6A1BDA 0000000035051B00 sasstgr:tkvercn1+0x90B9A&lt;BR /&gt;000000002D62CB86 0000000035052770 sasstgr:tkvercn1+0x1BB46&lt;BR /&gt;000000002D6A1BDA 00000000350527B0 sasstgr:tkvercn1+0x90B9A&lt;BR /&gt;000000002D67C388 0000000035052830 sasstgr:tkvercn1+0x6B348&lt;BR /&gt;000000002D6A1BDA 0000000035052870 sasstgr:tkvercn1+0x90B9A&lt;BR /&gt;000000002D689D20 0000000035052D50 sasstgr:tkvercn1+0x78CE0&lt;BR /&gt;000000002D6A1BDA 0000000035052D90 sasstgr:tkvercn1+0x90B9A&lt;BR /&gt;000000002D687F74 0000000035053980 sasstgr:tkvercn1+0x76F34&lt;BR /&gt;000000002D6A1BDA 00000000350539C0 sasstgr:tkvercn1+0x90B9A&lt;BR /&gt;000000002D68CAB5 0000000035053A30 sasstgr:tkvercn1+0x7BA75&lt;BR /&gt;0000000006921D0A 0000000035053A70 sasods:tkvercn1+0x220CCA&lt;BR /&gt;0000000006755CFD 0000000035053D10 sasods:tkvercn1+0x54CBD&lt;BR /&gt;0000000006754F4D 0000000035053FE0 sasods:tkvercn1+0x53F0D&lt;BR /&gt;0000000006921D0A 0000000035054020 sasods:tkvercn1+0x220CCA&lt;BR /&gt;000000000677B902 0000000035059330 sasods:tkvercn1+0x7A8C2&lt;BR /&gt;0000000033FB42AA 0000000035059338 sassgpan:tkvercn1+0xC326A&lt;BR /&gt;0000000033F2EE29 000000003505FBB0 sassgpan:tkvercn1+0x3DDE9&lt;BR /&gt;00000000034AA346 000000003505FBB8 sashost:Main+0x11E86&lt;BR /&gt;00000000034B040D 000000003505FF20 sashost:Main+0x17F4D&lt;BR /&gt;00007FF9194A7034 000000003505FF28 KERNEL32:BaseThreadInitThunk+0x14&lt;BR /&gt;00007FF91A3E2651 000000003505FF58 ntdll:RtlUserThreadStart+0x21&lt;/P&gt;
&lt;P&gt;NEWLINE FUNCTION NOT DEFINED IN THIS TAGSET&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SGPANEL used (Total process time):&lt;BR /&gt;real time 0.09 seconds&lt;BR /&gt;cpu time 0.04 seconds&lt;/P&gt;
&lt;P&gt;ERROR: Event Stack Underflow. This is probably caused by mis-matched begin and end event calls.&lt;BR /&gt;NOTE: There were 54 observations read from the data set WORK.EXAMPLE&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 21:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-Access-Violation-SGPANEL-and-stack-underflow-error/m-p/747972#M234852</guid>
      <dc:creator>megsredl</dc:creator>
      <dc:date>2021-06-14T21:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Read Access Violation SGPANEL and stack underflow error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-Access-Violation-SGPANEL-and-stack-underflow-error/m-p/747974#M234854</link>
      <description>I don't think it's the code shown that's causing the issues here. Are you piping this to a destination? Excel? PDF?</description>
      <pubDate>Mon, 14 Jun 2021 21:59:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-Access-Violation-SGPANEL-and-stack-underflow-error/m-p/747974#M234854</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-14T21:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Read Access Violation SGPANEL and stack underflow error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-Access-Violation-SGPANEL-and-stack-underflow-error/m-p/747975#M234855</link>
      <description>&lt;P&gt;Nope, just trying to run it normally. The newline error made me think that ODS may have somehow been involved so I tried putting ods close before the code, but still got the same message. I did use ODS earlier in the session but have closed it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 22:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-Access-Violation-SGPANEL-and-stack-underflow-error/m-p/747975#M234855</guid>
      <dc:creator>megsredl</dc:creator>
      <dc:date>2021-06-14T22:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Read Access Violation SGPANEL and stack underflow error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-Access-Violation-SGPANEL-and-stack-underflow-error/m-p/747994#M234864</link>
      <description>&lt;P&gt;I think "&lt;SPAN&gt;NEWLINE FUNCTION NOT DEFINED IN THIS TAGSET&lt;/SPAN&gt;" may tell you what is going on.&amp;nbsp; It could be there's a newline '0A'x somewhere in the data and it's causing a problem.&amp;nbsp; Normally a newline (line feed) should be preceded with a carriage return '0D'x if you're in a Windows environment.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you in a Windows environment?&amp;nbsp; What is your encoding?&amp;nbsp; Are you using WLATIN1?&amp;nbsp; Unicode?&amp;nbsp; Can you run the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc options option=encoding;
run;
proc options option=locale;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of equal importance:&amp;nbsp; What environment is the database in?&amp;nbsp; Unix?&amp;nbsp; Linux?&amp;nbsp; Mainframe?&amp;nbsp; Windows?&amp;nbsp; What is the database's encoding?&amp;nbsp; Unicode?&amp;nbsp; ASCII?&amp;nbsp; Or ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you've got some kind of funny character in your data somehow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I saw recently a blog post on how to find non-display characters in a SAS dataset.&amp;nbsp; Perhaps this may be useful:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://assemredouan.wordpress.com/2014/05/09/how-to-find-out-non-printable-characters-in-your-sas-dataset/" target="_blank" rel="noopener"&gt;https://assemredouan.wordpress.com/2014/05/09/how-to-find-out-non-printable-characters-in-your-sas-dataset/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jun 2021 00:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-Access-Violation-SGPANEL-and-stack-underflow-error/m-p/747994#M234864</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-06-15T00:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Read Access Violation SGPANEL and stack underflow error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-Access-Violation-SGPANEL-and-stack-underflow-error/m-p/747996#M234866</link>
      <description>&lt;P&gt;How many columns do you have?&amp;nbsp; We could try a couple of "quick and dirty" methods.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;To just remove just any stray new line characters, we could apply the below SAS code in a data step to each variable.&amp;nbsp; I'm using "Var" here to represent the columns in your table.&amp;nbsp; You'd have to use the real column names which, if there aren't too many, shouldn't be too tedious.&amp;nbsp; This is fairly safe code because SAS shouldn't treat actual line terminators (&lt;STRONG&gt;assuming you're on Windows)&amp;nbsp;&lt;/STRONG&gt;which are '0D0A'x together.&amp;nbsp; If you're on Linux/Unix, this might not work.&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Var = compress(Var, '0A'x);&lt;/CODE&gt;&lt;/PRE&gt;
&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;If that doesn't work, we could modify the compress like the below.&amp;nbsp; "kw" means "keep writable."&amp;nbsp; When used with COMPRESS, SAS will delete all the non-display/non-writeable characters and keep only the displayable/writeable characters.&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Make a backup copy of your data first&lt;/STRONG&gt; or write to a new dataset.&amp;nbsp; This could have unexpected results depending on what your encoding is and what was in the database and how it was trans-coded.&amp;nbsp; Most likely it will work fine.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Var = compress(Var, , 'kw');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Either of those two methods will remove any extraneous newline characters, and that might be all you need to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jun 2021 00:45:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-Access-Violation-SGPANEL-and-stack-underflow-error/m-p/747996#M234866</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-06-15T00:45:07Z</dc:date>
    </item>
  </channel>
</rss>

