data have; id1 = 'uv223'; id2 = ''; mid = 'uv223'; new_id = put(id1,id2,mid,best12.); run;
I have a file similar to the above. There are three possibilities for the same ID reference. I want to assign the variable value, in this case 'uv223' to a new character variable called new_id. In one of the id's there is no value however the other two do have the same value. So new_id should equal 'uv223'. As you can see I attempted to do this with a put statement but received an error
data have; id1 = 'uv223'; id2 = ''; mid = 'uv223'; new_id = coalescec(id1,id2,mid) ; run;
PUT() converts types.
What do you want to see as the output? My guess is you want the COALESCEC() function or possibly a CAT function.
@Q1983 wrote:
data have; id1 = 'uv223'; id2 = ''; mid = 'uv223'; new_id = put(id1,id2,mid,best12.); run;I have a file similar to the above. There are three possibilities for the same ID reference. I want to assign the variable value, in this case 'uv223' to a new character variable called new_id. In one of the id's there is no value however the other two do have the same value. So new_id should equal 'uv223'. As you can see I attempted to do this with a put statement but received an error
data have; id1 = 'uv223'; id2 = ''; mid = 'uv223'; new_id = coalescec(id1,id2,mid) ; run;
PUT() converts types.
What do you want to see as the output? My guess is you want the COALESCEC() function or possibly a CAT function.
@Q1983 wrote:
data have; id1 = 'uv223'; id2 = ''; mid = 'uv223'; new_id = put(id1,id2,mid,best12.); run;I have a file similar to the above. There are three possibilities for the same ID reference. I want to assign the variable value, in this case 'uv223' to a new character variable called new_id. In one of the id's there is no value however the other two do have the same value. So new_id should equal 'uv223'. As you can see I attempted to do this with a put statement but received an error
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.