DATA Step, Macro, Functions and more

Please Help..!!

Occasional Contributor
Posts: 5

Please Help..!!

DATA kids;
LENGTH kidname $ 4 sex $ 1;
INPUT famid kidname birth age wt sex ;
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

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


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. )



Super User
Posts: 5,884

Re: Please Help..!!

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
Occasional Contributor
Posts: 5

Re: Please Help..!!

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..!!





Super User
Posts: 6,785

Re: Please Help..!!

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;



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;



Super User
Posts: 10,784

Re: Please Help..!!

use other proc ? like proc sql, proc means ?



proc means data=sashelp.class nway sum ;
class sex;
var weight;
Ask a Question
Discussion stats
  • 4 replies
  • 4 in conversation