Statistics版 - How to concatenate these two varaibles in SAS: name||Birt |
|
|
|
|
|
l****g 发帖数: 304 | 1 For example:
value of name: zhang
value of Birthday: 090225 (format as yymmdd6.)
New value for the new variable: zhang090225; for the new variable, the birthday keeps yymmdd format(two digits year, two digits month, two digits day).
Thank you! | s*****n 发帖数: 2174 | 2 you need to specify:
1. what is your input file like
2. what platform do you want to use
3. what output format do you want.
keeps
【在 l****g 的大作中提到】 : For example: : value of name: zhang : value of Birthday: 090225 (format as yymmdd6.) : New value for the new variable: zhang090225; for the new variable, the birthday keeps yymmdd format(two digits year, two digits month, two digits day). : Thank you!
| l****g 发帖数: 304 | 3 Thank you, SongKun.
1. what is your input file like
Sas data file with:
Birthday format as yymmdd6.
Name format as $20.
2. what platform do you want to use
Windows?
3. what output format do you want.
I want to create another character variable which concatenate variable name
and variable Birthday.
The example:
name: zhang
Birthday: 090225
I want to create a new value: zhang090225 based on the name and birthday of
that record. | s*****n 发帖数: 2174 | 4 I don't know much about SAS.
Wait for SAS people to answer.
name
【在 l****g 的大作中提到】 : Thank you, SongKun. : 1. what is your input file like : Sas data file with: : Birthday format as yymmdd6. : Name format as $20. : 2. what platform do you want to use : Windows? : 3. what output format do you want. : I want to create another character variable which concatenate variable name : and variable Birthday.
| l****g 发帖数: 304 | 5 Thank you for clairyong what I am asking, Songkun. | q**j 发帖数: 10612 | 6 try this, it may or may not work:
compress(name||input(put(birthday,YYMMDD6.),$6.))
if II does not work cats() might do. | l****g 发帖数: 304 | 7 Thank you, QQZJ, it works!!
If I ingore the input funcion here as:
compress(name||put(birthday,YYMMDD6.)), it works also.
Thanks again! | y****1 发帖数: 400 | 8 Right, coz the compress function removes spaces by default.
【在 l****g 的大作中提到】 : Thank you, QQZJ, it works!! : If I ingore the input funcion here as: : compress(name||put(birthday,YYMMDD6.)), it works also. : Thanks again!
| q**j 发帖数: 10612 | 9 good to know. i am kind of surprised. learned sth new too.
【在 l****g 的大作中提到】 : Thank you, QQZJ, it works!! : If I ingore the input funcion here as: : compress(name||put(birthday,YYMMDD6.)), it works also. : Thanks again!
|
|
|
|
|
|
|