12345
12345

Reputation: 67

Append records on every run;

I have two macro variables.

%let subject=english;
%let task=easy;

data new;
    subject ="&subject";
    task = "&task";
run;

If I run the above code, I will have this dataset:

subject   task
english   easy

What I want is each time I run it, it needs to append new records. For example, if I run this code thrice my result should be.

subject  Task
english  Easy
english  Easy
english  Easy

Upvotes: 0

Views: 48

Answers (1)

Robert Soszyński
Robert Soszyński

Reputation: 1188

You have a lot of possibilities, I sugguest two of them.

PROC APPEND

%let subject=english;
%let task=easy;

data tmp;
    subject ="&subject";
    task="&task";
run;

proc append base=new data=tmp;
run;

PROC SQL

%let subject=english;
%let task=easy;

proc sql;
    insert into new (subject, task) values ("&subject", "&task");
quit;

Upvotes: 1

Related Questions