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;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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