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

Hi,

I want to create a two-panel graph using proc sgpanel in SAS 9.3. The y-axis should be the same for the two panels, but I want one x-axis to be on a linear scale and the other on a logarithmic scale (expand). Can that be done in 9.3, or do you have any other way to create this type of graph?

Best regards,

Tommy

1 ACCEPTED SOLUTION

Accepted Solutions
djrisks
Barite | Level 11

Hi Tommy,

You can use GTL to do this, below is an example.

proc template;
  define statgraph plot_linearlog;
    begingraph;
      layout lattice / rows = 1 columns = 2;

        layout overlay / xaxisopts=(type = linear);
       scatterplot x = Horsepower y = MPG_City;
     endlayout;

        layout overlay / xaxisopts=(type = log logopts = (tickintervalstyle = logexpand));
       scatterplot x = Horsepower y = MPG_City;
     endlayout;

   endlayout;
endgraph;
  end;
run;

proc sgrender data = sashelp.cars template = plot_linearlog;
run;

SGRender5.png

View solution in original post

3 REPLIES 3
djrisks
Barite | Level 11

Hi Tommy,

You can use GTL to do this, below is an example.

proc template;
  define statgraph plot_linearlog;
    begingraph;
      layout lattice / rows = 1 columns = 2;

        layout overlay / xaxisopts=(type = linear);
       scatterplot x = Horsepower y = MPG_City;
     endlayout;

        layout overlay / xaxisopts=(type = log logopts = (tickintervalstyle = logexpand));
       scatterplot x = Horsepower y = MPG_City;
     endlayout;

   endlayout;
endgraph;
  end;
run;

proc sgrender data = sashelp.cars template = plot_linearlog;
run;

SGRender5.png

tommyschyman
Calcite | Level 5

Thanks djrisks, you opened up a new world for me when introducing GLT. A little bit tricky to sort it all out, but I could create the graph exactly as I wanted.

Tommy

djrisks
Barite | Level 11

That's fine Tommy / Chris. I agree GTL is a lot more powerful and tricky, and I'm glad you were able to figure it out and create the graph exactly as you wanted.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2221 views
  • 0 likes
  • 2 in conversation