Data visualization with SAS programming

Problem with using PROC SGPANEL

Reply
Occasional Contributor
Posts: 5

Problem with using PROC SGPANEL

[ Edited ]

Hi,

 

I am using PROC SGPANEL to plot graphs by year. I sorted dataset first, however, the SGPANEL does produce a confusing error suggesting I haven't sorted the dataset. Year is a numeric variable and I do not impose any particular format for it.

Any thoughts what I am doing wrong?

 

Below I attach the log

 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 61         
 62         proc sort data=temp out=xx;
 63         by year;
 64         run;
 
 NOTE: There were 16145577 observations read from the data set WORK.TEMP.
 NOTE: The data set WORK.XX has 16145577 observations and 23 variables.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           3.61 seconds
       cpu time            10.53 seconds
       
 
 65         proc sgpanel data=xx noautolegend;
 66           title "Travel time to work distribution ";
 67           panelby year;
 68           format trantime traveltimeCat_f.;
 69           histogram TRANTIME / binstart=1 binwidth=10;
 70         colaxis max=120;
 71         run;
 
  
 ERROR:  An exception has been encountered.
 Please contact technical support and provide them with the following traceback information:
  
 The SAS task name is [SGPANEL ]
 Segmentation Violation
  
 Traceback of the Exception:
  
 /usr/local/SAS/SASFoundation/9.4/sasexe/sas(+0x15cfde) [0x55779b2f1fde]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sas(+0x4cb7b) [0x55779b1e1b7b]
 /usr/local/SAS/SASFoundation/9.4/sasexe/tkmk.so(bkt_signal_handler+0x144) [0x7f681b961404]
 /lib64/libpthread.so.0(+0xf5e0) [0x7f681cbc75e0]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasxkern(__intel_ssse3_rep_memcpy+0x45) [0x7f680b27ca65]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasxkern(ypcdo2+0xa0) [0x7f680b217ba0]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasxkern(ypfmtc+0xe7) [0x7f680b217a17]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasxkern(+0x72fb0) [0x7f680b227fb0]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasxkern(ypslf+0x951) [0x7f680b227171]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasxkern(ypmpstr+0x248) [0x7f680b223518]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasxkern(ypmstr+0x9d) [0x7f680b2232bd]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasyh(+0x3183f) [0x7f680a94283f]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasyh(+0x30aa6) [0x7f680a941aa6]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasyh(yyhlock+0x8df) [0x7f680a93e28f]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasyh(yhgenop+0x3da) [0x7f680a91dfea]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasyoio(yyoopen+0x7e6b) [0x7f67d60c747b]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sasyoio(yoopen+0x1eb) [0x7f67d60bf23b]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sassgpan(sortClassData+0x1b9) [0x7f67b9a85eb9]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sassgpan(sassgpan+0x11c97) [0x7f67b9aac267]
 /usr/local/SAS/SASFoundation/9.4/sasexe/sas(vvtentr+0x13d) [0x55779b1e171d]
 /lib64/libpthread.so.0(+0x7e25) [0x7f681cbbfe25]
 /lib64/libc.so.6(clone+0x6d) [0x7f681c1b034d]
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: There were 16145577 observations read from the data set WORK.XX.
  
 ERROR:  An exception has been encountered.
 Please contact technical support and provide them with the following traceback information:
  
 The SAS task name is [SGPANEL ]
 Segmentation Violation
  
 72         title;
 73         
 74         
 75         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 88         

 

Super User
Posts: 22,843

Re: Problem with using PROC SGPANEL

The error has nothing to do with the sort, but it's different. 

Are graphs in general working for you?

 

What about the following:

 

 proc sgpanel data=xx ;
 panelby year;
 format trantime traveltimeCat_f.;
 histogram TRANTIME;

 run;

And this:

 

proc sgpanel data=sashelp.iris;
  title "Scatter plot for Fisher iris data";
  panelby species / columns=3;
 
 reg x=sepallength y=sepalwidth / cli clm;
run;

Please post the logs from both. 

Occasional Contributor
Posts: 5

Re: Problem with using PROC SGPANEL

Thank you for a prompt answer.

Yes, graphics works for me. Your code using iris dataset does work without problems. 

 

Indeed it might be a memory problem. It is a big dataset and I want to use all the observation to compute histograms. That was one of the main reasons I decided to work with SAS on this.

 

To check this I sampled a smaller dataset and tried to run the code unsuccessfully again.

 

 

 

 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 61         
 62         proc sort data=temp;
 63         by TRANTIME;
 64         run;
 
 NOTE: There were 433 observations read from the data set WORK.TEMP.
 NOTE: The data set WORK.TEMP has 433 observations and 23 variables.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 65         data temp;
 66         set temp(where=(year>1970 and TRANTIME>0));
 67         run;
 
 NOTE: There were 433 observations read from the data set WORK.TEMP.
       WHERE (year>1970) and (TRANTIME>0);
 NOTE: The data set WORK.TEMP has 433 observations and 23 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 68         proc summary data=temp print;
 69         var year trantime;
 70         run;
 
 NOTE: There were 433 observations read from the data set WORK.TEMP.
 NOTE: PROCEDURE SUMMARY used (Total process time):
       real time           0.02 seconds
       cpu time            0.01 seconds
       
 
 71         proc sort data=temp;
 72         by year;
 73         run;
 
 NOTE: There were 433 observations read from the data set WORK.TEMP.
 NOTE: The data set WORK.TEMP has 433 observations and 23 variables.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 74         proc sgpanel data=temp noautolegend;
 75           panelby year;
 76           histogram trantime ;
 77         run;
 
 ERROR: The data set must be sorted by the list of variables on the PANELBY statement.
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: There were 433 observations read from the data set WORK.TEMP.
 NOTE: PROCEDURE SGPANEL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 78         
 79         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 92         

 

 

The SUMMARY Procedure

 Variable Label N Mean Std Dev Minimum Maximum

YEAR
TRANTIME
Census year
Travel time to work
433
433
1996.24
22.5473441
9.9844846
18.2079856
1980.00
1.0000000
2016.00
162.0000000

 

 

Sometimes when I sort the data for the first time, the SGPANEL does not complain about sorting but produce the very long error as in the initial post.

 

I have no idea what might be the cause.

Super User
Posts: 22,843

Re: Problem with using PROC SGPANEL

Unfortunately this sounds like a tech support issue now Smiley Sad

 

I would open a track with them to help you resolve this.

SAS Super FREQ
Posts: 1,044

Re: Problem with using PROC SGPANEL

What version of SAS are you using?

Occasional Contributor
Posts: 5

Re: Problem with using PROC SGPANEL

[ Edited ]

Sas Studio under Linux. I believe SAS release: 9.04  (version 3.6 ?) 

Super User
Posts: 22,843

Re: Problem with using PROC SGPANEL

Is this SAS UE? Or a separate installation? If it's SAS UE you're very likely running out of memory, but you can increase that in your Oracle VM settings. 

 


@ewelina2 wrote:

Sas Studio under Linux. I believe SAS release: 9.04  (version 3.6 ?) 


 

Esteemed Advisor
Posts: 5,394

Re: Problem with using PROC SGPANEL

Could it be that YEAR has a two digit format which would make the formatted year values unsorted?

PG
Occasional Contributor
Posts: 5

Re: Problem with using PROC SGPANEL

No

But I did have a format of the form:

value YEAR_f.
1980 = '1980'
..... other years......
2010 = '2010'
;

 

which I didn't suspect to cause troubles since other "by" statements used in other procedures worked without any problems.

 

However, after deleting the format and using unformatted variable"year" in panelby statement, PROC SGPANEL worked fine.

 

Another observation I made is that once the PROC SGPANEL was unsuccessfully run once, it created a temporary file in "WORK" library, which I couldn't delete manually. I had to reopen SAS to have it deleted. I think this was causing the error that says "Your dataset was not sorted" even though it runs the proc sort simultaneously with PROC SGPANEL when I tried to run the SGPANEL again. 

 

Bottom line, PROC SGPANEL and especially panelby is very sensitive to the format used and once run with error will not be able to run again without closing SAS.

 

I am still confused when the original values and when the formatted values are used when executing "by" "group" "category" "panelby" statements.

 

Thank you all for help!

Super User
Posts: 22,843

Re: Problem with using PROC SGPANEL

I think you can specify the GROUPFORMAT option instead to get around that on your BY statement.

 

by year groupformat;

http://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=p0yeyftk8ftuckn1o5qzy53284gz.htm&docs...

Ask a Question
Discussion stats
  • 9 replies
  • 215 views
  • 2 likes
  • 4 in conversation