MetallicPriest
MetallicPriest

Reputation: 30765

How to use a variable in Data step without including it as a column in SAS

When I use the Data Step, I don't want to include temporary variables as columns. For example, in the following, while I want to include y as a column, I don't want to include a and b as columns. How can I tell SAS to not include a and b as columns?

Data Table1;
Set Table2;
a=scan(column_x,1,'_')
b=scan(column_x,2,'_')
y=cats(a, ':', b)
Run;

Upvotes: 1

Views: 697

Answers (1)

Richard
Richard

Reputation: 27508

Use

  • the DROP statement
    DROP A B;
  • or (DROP= data set option
    DATA Table1(Drop=A B);
  • or KEEP statement
  • or (KEEP= data set option

You would explicitly list the desired variables when coding KEEP.

Upvotes: 6

Related Questions