BookmarkSubscribeRSS Feed
SAM_VAS
Calcite | Level 5

DATA kids;
LENGTH kidname $ 4 sex $ 1;
INPUT famid kidname birth age wt sex ;
CARDS;
1 Beth 1 9 60 f
1 Bob 2 6 40 m
1 Barb 3 3 20 f
2 Andy 1 8 80 m
2 Al 2 6 50 m
2 Ann 3 2 20 f
3 Pete 1 6 60 m
3 Pam 2 4 40 f
3 Phil 3 2 20 m
;
RUN;


data totalweight;
set kids;
by famid;
if first.famid then weight = wt;
else weight+wt;
if last.famid;
run;

 

Guys my Question is that is there any way that I can see my answer only with familyID & total weight.

 

I dnt wanna see the rest of VAR..!! Please help me..!! ( Dnt wanna use drop & keep Fuct. )

 

 

4 REPLIES 4
LinusH
Tourmaline | Level 20

First, everyone that posts questions are entitled answers if there's anyone who wishes to answers them. So please have a descriptive title for your question as subject, not a cry for help.

 

And why don't want to use keep/drop, when that's the simplest way to accomplish your question?

ANd by the way, what do you mean "see"?

If his is a report, you usually explicitly tell which variables you wish to present, regardless of what variables that is stored in the underlying data set.

Data never sleeps
SAM_VAS
Calcite | Level 5

Dear Linush

 

First please allow me thank you for the answer ..!! And I would like to tell you that I m not crying for the ans. its just that i am new to sas supprt communities ..!!

 

So I am learning the thinks ..!! how to make it better..

 

Again thank you for your kind supprt & help..!!

 

 

 

 

Astounding
PROC Star

As Linus mentioned, it's important to know how you are viewing the results.  You could easily control the variables that print in a report:

 

proc print data=totalweight;

var famid weight;

run;

 

However, if you are viewing the data set interactively, the easiest way would be to move those columns to the left and ignore the columns on the right.  To move those columns to the left, modify the LENGTH statement so that it defines them first:

 

LENGTH famid weight 8 kidname $ 4 sex $ 1;

 

 

Ksharp
Super User

use other proc ? like proc sql, proc means ?

 

 

proc means data=sashelp.class nway sum ;
class sex;
var weight;
run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 4 replies
  • 817 views
  • 0 likes
  • 4 in conversation