Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: how to merge two variables into one

From   "b. water" <>
Subject   RE: st: how to merge two variables into one
Date   Mon, 28 Nov 2005 09:37:38 +0000

thanks nick for your reply. it turns out that -trim()- was not what i was looking for. i managed to get what i want (99% of it in any case) by trial and error with helps from the manual (i looked at append, merge, trim and searched for concat, where i stumbled upon egen option that did the trick). this is the command that i used:

egen studynyr = concat (study year), punct(" ")

i tried to right justify the apperance of studynyr by adding format (%15s)

i.e.: egen studynyr = concat (study year), format (%15s) punct(" ")

but keep getting 'Invalid format'. however when i list the data, appearance seems to be as i like it so i might not have to force right justification but i would still appreciate advice on how to get the right justification command correct.


From: "Nick Cox" <>
To: <>
Subject: RE: st: how to merge two variables into one
Date: Sun, 27 Nov 2005 16:43:57 -0000

When you say merge, I guess you mean

Assumed that you have applied -trim()-,
right-alignment is a matter of format,
not of what the values are, nor of how
they are held informally.

You should read up the help on formats.


b. water

> i have two variables: studynames and yearofstudy e.g. Alshop
> 1981, Bell 1992.
> what i want to do is to merge the two variables such that:
> Alshop 1981
>     Bell 1992
> i.e. somehow it is right-aligned in each cell.
> would be grateful for help in achieving this.
> platform: stata 8.2, os wxp pro sp2.

*   For searches and help try:
On the road to retirement? Check out MSN Life Events for advice on how to get there!

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index