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 9240411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:11:07+00:00 2026-06-18T08:11:07+00:00

data _null_; set hash.bankholidays; retain total 0; format date :date9.; set hash.oyster; datetime =

  • 0
    data _null_;
    set hash.bankholidays;

        retain total 0; 
        format date :date9.;

        set hash.oyster;
            datetime = datepart(datetime);
            format datetime :date9. ;

            if date eq datetime then do;
            total = total + amount; end;


    put "total =" total; 

    run;    

This gives me a popup dialog box in eclipse:
Multiple SET/MERGE statements in a data step

I’m wondering what’s going on here? It seems to be saying that you can’t have a set statement within a set statement, but I’m sure I’ve done it before.

eg.

    data data_ex.giftwrap_ribbon_final; 
    set data_ex.giftwrap_w_ribbon_fl; 
        if not missing (first) and not missing (last) then do;
            do i = first to last;
            set data_ex.ribbon (keep=ribbon_colour) point = i;
            output;
            end;
        end; 

        else do;
        ribbon_colour = ''; 
        output; 
        end;
    run;

could I get some clarification here?

Also, about that last put. How do I tell it to execute the put after the set statement has finished?

  • 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-18T08:11:08+00:00Added an answer on June 18, 2026 at 8:11 am

    You need to wrap the set statment in a do loop and use pointers.

    data _null_;
    set hash.bankholidays;
    
        retain total 0; 
        format date :date9.;
    
        do i = 1 to nobs; 
            set hash.oyster point = i nobs = nobs; 
                datetime = datepart(datetime);
                format datetime :date9. ;
    
                if date eq datetime then do;
                total = total + amount; end;
        end;
    
    put "total =" total; 
    
    run;    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following: data; format x datetime19.; x=datetime(); flag='FIRST'; do x=datetime() to x+10 by
I want it to count then if @intcount > 0 it should show data
How do I make it retry the send attempt if user data is null.
If I have JSON data such as: { datapoints:[ [null, 1234567890, point1], [null, 1234567890,
I have some data which (quite reasonably) uses null and false for different meanings.
The SDK only said the null will returned if the image data could not
Given the following data/schema: DECLARE @t1 TABLE ( Id int NOT NULL ) DECLARE
I have a table with data: id a_no accountname 1 NULL ac1 1 234
I import data from a TSV file with SQL Server 2008. null is replaced
I have the following table: CREATE TABLE [dbo].[Data] ( [Id] UNIQUEIDENTIFIER NOT NULL, [Data]

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.