Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7564973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:01:48+00:00 2026-05-30T14:01:48+00:00

I am plotting some data using BY GROUP option. While I am able to

  • 0

I am plotting some data using BY GROUP option. While I am able to use #byval option to automatically put BY GROUP value in title of each plot, but I want to save each plot individually and want to name it after #byval instead of calling it – SGPLOT01, SGPLOT02 …

e.g. Lets say I have:

data xyz;
input type$ x y1 y2@@;
cards;
A 1 5 7
A 2 7 9
A 3 8 10
B 1 5 7
B 2 7 9
B 3 8 10
;;
RUN;

PROC SGPLOT DATA=xyz;
by type;
series1 x=x y=y1/markers;
series2 x=x y=y2/markers;
title "#byval";
RUN;

In this example, two plots will be created one each for type A and B. But program will automatically name them as SGPLOT1.pdf and SGPLOT2.pdf. I would rather want to name them A.pdf and B.pdf, and want to save them to directory “C:/SGPLOTS/”.

Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:01:49+00:00Added an answer on May 30, 2026 at 2:01 pm

    One option is to use ODS and put use a macro to print each TYPE separately, like in the following example.

    data xyz;
    input type$ x y1 y2 @@;
    cards;
    A 1 5 7
    A 2 7 9
    A 3 8 10
    B 1 5 7
    B 2 7 9
    B 3 8 10
    ;
    RUN;
    
    ods listing close;
    
    %macro plot_it(type=);
    
       goptions reset
          device = sasprtc
          target = sasprtc
          ;
    
       ods pdf file="C:/SGPLOTS/&type..pdf" notoc;
    
       PROC SGPLOT DATA=xyz;
       by type;
       where type = "&type";
       series x=x y=y1/markers;
       series x=x y=y2/markers;
       title "#byval";
       RUN;
    
       ods pdf close;
    
    %mend plot_it;
    
    %plot_it(type=A);
    %plot_it(type=B);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am ploting some data using BY GROUP option, and saving each plot
I'm plotting some data using geom_smooth and looking for a way to change the
I am thinking of using wxMathPlot for plotting/graphing some data that arrives continuously. I
i am plotting some data in R using the following commands: jj = ts(read.table(overlap.txt))
I'm writing some data acquisition software and need a gui plotting library that is
I'm plotting a group of curves, using facet in ggplot2. I'd like to have
Is it possible to put some data into gnuplot right on it's prompt? Like
I'm using MATLAB to plot some data. I would like to create the legend
I am using Matplotlib to create an image based on some data. All of
I am plotting some curves using twin-axis and also scientific notation. I have set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.