BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
megsredl
Obsidian | Level 7

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:

 

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;

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.

 

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;

Thank you for the help!

 

 

ERROR: An exception has been encountered.
Please contact technical support and provide them with the following traceback information:

The SAS task name is [SGPANEL]
ERROR: Read Access Violation SGPANEL
Exception occurred at (06882F72)
Task Traceback
Address Frame (DBGHELP API Version 4.0 rev 5)
0000000006882F72 000000003504F560 sasods:tkvercn1+0x181F32
000000000D329C3A 000000003504F568 sasxml:tkvercn1+0x48BFA
000000000D30EF48 000000003504FB80 sasxml:tkvercn1+0x2DF08
0000000006921D0A 000000003504FBC0 sasods:tkvercn1+0x220CCA
0000000006884769 0000000035050080 sasods:tkvercn1+0x183729
000000000E1D831A 0000000035050088 sasmrk:tkvercn1+0x1172DA
000000000E14251E 0000000035050830 sasmrk:tkvercn1+0x814DE
000000002D6A1BDA 0000000035050838 sasstgr:tkvercn1+0x90B9A
000000002D61C289 0000000035050A00 sasstgr:tkvercn1+0xB249
000000002D66A100 0000000035051070 sasstgr:tkvercn1+0x590C0
0000000008A9C09A 0000000035051078 saswobc:tkvercn1+0x1B05A
0000000008A8BE65 0000000035051180 saswobc:tkvercn1+0xAE25
000000002D6A1BDA 00000000350511C0 sasstgr:tkvercn1+0x90B9A
000000002D627B84 0000000035051240 sasstgr:tkvercn1+0x16B44
000000002D6A1BDA 0000000035051280 sasstgr:tkvercn1+0x90B9A
000000002D66A4DF 00000000350518F0 sasstgr:tkvercn1+0x5949F
0000000008A9C09A 0000000035051930 saswobc:tkvercn1+0x1B05A
0000000008A8BE65 0000000035051A00 saswobc:tkvercn1+0xAE25
000000002D6A1BDA 0000000035051A40 sasstgr:tkvercn1+0x90B9A
000000002D627B84 0000000035051AC0 sasstgr:tkvercn1+0x16B44
000000002D6A1BDA 0000000035051B00 sasstgr:tkvercn1+0x90B9A
000000002D62CB86 0000000035052770 sasstgr:tkvercn1+0x1BB46
000000002D6A1BDA 00000000350527B0 sasstgr:tkvercn1+0x90B9A
000000002D67C388 0000000035052830 sasstgr:tkvercn1+0x6B348
000000002D6A1BDA 0000000035052870 sasstgr:tkvercn1+0x90B9A
000000002D689D20 0000000035052D50 sasstgr:tkvercn1+0x78CE0
000000002D6A1BDA 0000000035052D90 sasstgr:tkvercn1+0x90B9A
000000002D687F74 0000000035053980 sasstgr:tkvercn1+0x76F34
000000002D6A1BDA 00000000350539C0 sasstgr:tkvercn1+0x90B9A
000000002D68CAB5 0000000035053A30 sasstgr:tkvercn1+0x7BA75
0000000006921D0A 0000000035053A70 sasods:tkvercn1+0x220CCA
0000000006755CFD 0000000035053D10 sasods:tkvercn1+0x54CBD
0000000006754F4D 0000000035053FE0 sasods:tkvercn1+0x53F0D
0000000006921D0A 0000000035054020 sasods:tkvercn1+0x220CCA
000000000677B902 0000000035059330 sasods:tkvercn1+0x7A8C2
0000000033FB42AA 0000000035059338 sassgpan:tkvercn1+0xC326A
0000000033F2EE29 000000003505FBB0 sassgpan:tkvercn1+0x3DDE9
00000000034AA346 000000003505FBB8 sashost:Main+0x11E86
00000000034B040D 000000003505FF20 sashost:Main+0x17F4D
00007FF9194A7034 000000003505FF28 KERNEL32:BaseThreadInitThunk+0x14
00007FF91A3E2651 000000003505FF58 ntdll:RtlUserThreadStart+0x21

NEWLINE FUNCTION NOT DEFINED IN THIS TAGSET
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SGPANEL used (Total process time):
real time 0.09 seconds
cpu time 0.04 seconds

ERROR: Event Stack Underflow. This is probably caused by mis-matched begin and end event calls.
NOTE: There were 54 observations read from the data set WORK.EXAMPLE

1 ACCEPTED SOLUTION

Accepted Solutions
jimbarbour
Meteorite | Level 14

How many columns do you have?  We could try a couple of "quick and dirty" methods.

 

  1. To just remove just any stray new line characters, we could apply the below SAS code in a data step to each variable.  I'm using "Var" here to represent the columns in your table.  You'd have to use the real column names which, if there aren't too many, shouldn't be too tedious.  This is fairly safe code because SAS shouldn't treat actual line terminators (assuming you're on Windows) which are '0D0A'x together.  If you're on Linux/Unix, this might not work.
    Var = compress(Var, '0A'x);
     
  2. If that doesn't work, we could modify the compress like the below.  "kw" means "keep writable."  When used with COMPRESS, SAS will delete all the non-display/non-writeable characters and keep only the displayable/writeable characters.  Make a backup copy of your data first or write to a new dataset.  This could have unexpected results depending on what your encoding is and what was in the database and how it was trans-coded.  Most likely it will work fine.  
    Var = compress(Var, , 'kw');

Either of those two methods will remove any extraneous newline characters, and that might be all you need to do.

 

Jim

View solution in original post

4 REPLIES 4
Reeza
Super User
I don't think it's the code shown that's causing the issues here. Are you piping this to a destination? Excel? PDF?
megsredl
Obsidian | Level 7

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. 

jimbarbour
Meteorite | Level 14

I think "NEWLINE FUNCTION NOT DEFINED IN THIS TAGSET" may tell you what is going on.  It could be there's a newline '0A'x somewhere in the data and it's causing a problem.  Normally a newline (line feed) should be preceded with a carriage return '0D'x if you're in a Windows environment. 

 

Are you in a Windows environment?  What is your encoding?  Are you using WLATIN1?  Unicode?  Can you run the following:

 

proc options option=encoding;
run;
proc options option=locale;
run;

Of equal importance:  What environment is the database in?  Unix?  Linux?  Mainframe?  Windows?  What is the database's encoding?  Unicode?  ASCII?  Or ?

 

I think you've got some kind of funny character in your data somehow.

 

I saw recently a blog post on how to find non-display characters in a SAS dataset.  Perhaps this may be useful:

https://assemredouan.wordpress.com/2014/05/09/how-to-find-out-non-printable-characters-in-your-sas-d...

 

Jim

 

jimbarbour
Meteorite | Level 14

How many columns do you have?  We could try a couple of "quick and dirty" methods.

 

  1. To just remove just any stray new line characters, we could apply the below SAS code in a data step to each variable.  I'm using "Var" here to represent the columns in your table.  You'd have to use the real column names which, if there aren't too many, shouldn't be too tedious.  This is fairly safe code because SAS shouldn't treat actual line terminators (assuming you're on Windows) which are '0D0A'x together.  If you're on Linux/Unix, this might not work.
    Var = compress(Var, '0A'x);
     
  2. If that doesn't work, we could modify the compress like the below.  "kw" means "keep writable."  When used with COMPRESS, SAS will delete all the non-display/non-writeable characters and keep only the displayable/writeable characters.  Make a backup copy of your data first or write to a new dataset.  This could have unexpected results depending on what your encoding is and what was in the database and how it was trans-coded.  Most likely it will work fine.  
    Var = compress(Var, , 'kw');

Either of those two methods will remove any extraneous newline characters, and that might be all you need to do.

 

Jim

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 720 views
  • 2 likes
  • 3 in conversation