BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BrahmanandaRao
Lapis Lazuli | Level 10

how to Create a view from the view.?

how to Create a data set from the view.?

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

@BrahmanandaRao wrote:
Can we update (add column ,rename of variables etc.,) view and index in sas

Think a little about it:

A view takes one or more datasets, possibly combines the data, and possibly applies logic to the data.

Can you think of a way to reverse-engineer the input data from a change in the end result without a VERY serious programming effort?

 

So the answer is a plain NO.

 

But you can describe the view, both data step and SQL, and then use that as a base for changed code:

data class / view=class;
set sashelp.class;
rate = weight / Height;
run;

data view=class;
describe;
run;

proc sql;
create view class as
  select
    *,
    weight / height as rate
  from sashelp.class
;
quit;

proc sql;
describe view class;
quit;

View solution in original post

3 REPLIES 3
Shmuel
Garnet | Level 18

Suppose you have a data set named WORK.HAVE.

 

create a view by - input can be either a data set or a view

        data my_view / view=my_view;
           set have;
                /* add any sas code */
        run;

Create a data set from a view:

              data new;
                 set my_view;
             run;
BrahmanandaRao
Lapis Lazuli | Level 10
Can we update (add column ,rename of variables etc.,) view and index in sas
Kurt_Bremser
Super User

@BrahmanandaRao wrote:
Can we update (add column ,rename of variables etc.,) view and index in sas

Think a little about it:

A view takes one or more datasets, possibly combines the data, and possibly applies logic to the data.

Can you think of a way to reverse-engineer the input data from a change in the end result without a VERY serious programming effort?

 

So the answer is a plain NO.

 

But you can describe the view, both data step and SQL, and then use that as a base for changed code:

data class / view=class;
set sashelp.class;
rate = weight / Height;
run;

data view=class;
describe;
run;

proc sql;
create view class as
  select
    *,
    weight / height as rate
  from sashelp.class
;
quit;

proc sql;
describe view class;
quit;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1120 views
  • 0 likes
  • 3 in conversation