Hi all,
I have a dataset that looks something like this:
ID Var1 Var2 Var3
1 ABC DEF GHI
2 XYZ
3 ABC XYZ
I'd like to create a new variable, concatenate, that looks like this:
ID concatenate
1 ABC, DEF, GHI
2 XYZ
3 ABC, XYZ
However, when I write the code
I get this:
ID concatenate
1 ABC, DEF, GHI,
2 XYZ,,,
3 ABC, XYZ,,
I'd like to find a way to avoid concatenating if the values of any Var variable are blank. Any suggestions?
Thanks,
Erika
I have a dataset that looks something like this:
ID Var1 Var2 Var3
1 ABC DEF GHI
2 XYZ
3 ABC XYZ
I'd like to create a new variable, concatenate, that looks like this:
ID concatenate
1 ABC, DEF, GHI
2 XYZ
3 ABC, XYZ
However, when I write the code
Code:
concat(Var*), punct(", ")
ID concatenate
1 ABC, DEF, GHI,
2 XYZ,,,
3 ABC, XYZ,,
I'd like to find a way to avoid concatenating if the values of any Var variable are blank. Any suggestions?
Thanks,
Erika
Comment