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

  • SEARCH
  • Home
  • 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 8107127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:40:15+00:00 2026-06-06T00:40:15+00:00

In SAS, is it possible to refer a %let statement to a value located

  • 0

In SAS, is it possible to refer a %let statement to a value located in a database?

For instance, the value of my n in %let n=50 depends on some value calculated in one of my databases, e.g., first row plus first column. And since that value gets modified 100 times in my loop I don’t want to manually enter that value.

  • 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-06-06T00:40:17+00:00Added an answer on June 6, 2026 at 12:40 am

    There’s several ways to do this. Here’s two:

    proc sql;
     select a+b into :n
     from your_table
     where some_condition;
    quit;
    

    This populations a macro variable, &n, with the sum of the variables a and b. The condition you specify should be true only for one row of your table.

    Another approach:

    data tmp;
     set your_table;
     if _n_=1 then do;
      call symputn('n',a+b);
     end;
    run;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a SAS dataset from a database that includes a VARCHAR(5) key
I have two SAS data tables. The first has many millions of records, and
I was attempting to use regular expressions in a SAS SQL statement and couldn't
How is it possible that the binary executed 'by default' -- ie. the first
Using SAS's Proc SQL, is there a way to insert records from a SAS
In SAS 9, how can I in a simple data step, rearrange the order
In SAS/IML I have defined a character variable: var1 = usernames; Previously in the
I'm using SAS 9.1.3 to call a macro in a DATA step, but the
I'm learning SAS and write this macro: %macro firstMacro(mvLO, OLO); %local Count; %local Wordy;
I have a matrix in SAS IML. For each pair of rows (say vectors

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.