sas >> put table together.

by zhujp98 » Thu, 04 Jun 2009 05:46:57 GMT

table t1
v1
1
2
3
4
5
6

table t2
v2
3
4
6

table t3
v3
3
18

I want to get
table v
v1 v2 v3
1 3 3
2 4 8
3 8
4
5
6


how can I get that, thanks
jeff


sas >> put table together.

by Nathaniel.Wooding » Thu, 04 Jun 2009 05:54:17 GMT


Jeff

Usually, one uses a Merge statement with a "BY" variable that tells SAS how
to match observations. In your case, you do not need a By statement:

Data t1;
input v1;
cards;
1
2
3
4
5
6
run;
Data t2;
input v2;
cards;
3
4
6
run;
Data t3;
input v3;
cards;
3
18
run;
Data All;
merge T1 T2 T3;
run;
Proc print;run;

Now, this works assuming that you had typos in your third line for V2 and
the second line of V3 in the example of what you wanted your final table to
be.



Nat Wooding
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
Cel Phone: 804-205-0752



Jeff
< XXXX@XXXXX.COM
M> To
Sent by: "SAS(r) XXXX@XXXXX.COM
Discussion" cc
< XXXX@XXXXX.COM
GA.EDU> Subject
put table together.

06/03/2009 05:46
PM


Please respond to
Jeff
< XXXX@XXXXX.COM
M>






table t1
v1
1
2
3
4
5
6

table t2
v2
3
4
6

table t3
v3
3
18

I want to get
table v
v1 v2 v3
1 3 3
2 4 8
3 8
4
5
6


how can I get that, thanks
jeff


CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.



sas >> put table together.

by Mterjeson » Thu, 04 Jun 2009 05:57:06 GMT

Hi Jeff,

Here is one approach via datastep:

data t1;
input v1;
cards;
1
2
3
4
5
6
;
run;

data t2;
input v2;
cards;
3
4
6
;
run;

data t3;
input v3;
cards;
3
18
;
run;


data result;
merge t1 t2 t3;
run;



Hope this is helpful.


Mark Terjeson
Investment Business Intelligence
Investment Management & Research
Russell Investments
253-439-2367


Russell
Global Leaders in Multi-Manager Investing





-----Original Message-----
From: SAS(r) Discussion [mailto: XXXX@XXXXX.COM ] On Behalf Of
Jeff
Sent: Wednesday, June 03, 2009 2:47 PM
To: XXXX@XXXXX.COM
Subject: put table together.

table t1
v1
1
2
3
4
5
6

table t2
v2
3
4
6

table t3
v3
3
18

I want to get
table v
v1 v2 v3
1 3 3
2 4 8
3 8
4
5
6


how can I get that, thanks
jeff


put table together.

by chang_y_chung » Thu, 04 Jun 2009 05:58:25 GMT





hi, jeff,
here is one way. a good reference book on this kind of data manipulations
is at http://tinyurl.com/qm372g or
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a0013
03248.htm
hth.
cheers,
chang

data t1;
do v1 = 1 to 6; output; end;
run;
data t2;
do v2=3 to 6; output; end;
run;
data t3;
do v3=3, 18; output; end;
run;

/* combine them *side ways* */
data tAll;
merge t1 t2 t3;
/* by intentionally dropped */
run;

/* check */
proc print data=tAll;
run;
/* on lst
Obs v1 v2 v3

1 1 3 3
2 2 4 18
3 3 5 .
4 4 6 .
5 5 . .
6 6 . .
*/


Similar Threads

1. how to put two graphs together?

2. How to put a table in an external file (txt-file)

3. put charts and frequency table in one file?

Hi,

I know this is a basic question but I really want to learn...

If I would like to put gcharts and proc freq tables in one file, what can I
do?

I have thought to try...

ods pdf body= 'output.pdf';

proc freq data= mydata;
title ' freq report';
tables xxx / list missing;
run;

proc gchart data= mydata;
hbar xxx2 / something here;
run;

ods pdf close;

Is there any way more straightforward and neat to do this?


Thank you.

Richard



4. SASTip 131 - Putting multiple graphs & tables on an HTML page

5. How to add the whole column together

I need to add up the whole column to get one of total number.

Which proc I can use to get the total number?

Thanks!

6. Stringing values together

7. TABLES TABLES TABLES

How would you best describe to a retiscent SAS student that the concept of
TABLES isn't limited to SQL?  This came up during a discussion on table
lookup methods - and lookup tables in particular (I mean, lookup tables pre-
date SQL).  Even SAS data sets are referred to as tables.  This made the
student apoplectic.

Words of wisdom most welcome!!!

Thanks,
Howard

8. keep and rename together