I know this is a basic question but any help is appreciated. Also I numbered my questions in order to makes it easier to answer. I have multiple datasets (lets call them dt1, dt2, dt3, ...) that I need to concatenate. My datasets have the same columns, but when using the bellow code: data aggregated_dt;
set dt1 dt2 dt3;
run; I get error that many columns with the same name don't have compatible formats. (for the sake of simplicity lets say I only get error for one column and that column is col1) so col1 is numeric in dt1 and character in dt2, consequently concatenation fails. As a solution I want to convert col1 from numeric to character in dt1. So here are my questions: Can I convert col1 to character when importing dt1, if yes, how? (right now, I import dt1 first and then convert col1 format.) As far as I know, there is no way that I can overwrite col1 in one step so I use the following code to convert the col1: data dt1 (drop= new_col);
set dt1(rename=(col1=new_col));
col1 = put(new_col, $12.); run; When I check the result I have a SAS table that looks fine but when I use proc contents step as follow: proc contents data= dt1;
run; I see that informat and format column are empty for col1 in variable table. 2. Is this going to make issue down the road? 3. I can add "format col1 $12. ;" in data step but I am not sure if this is a redundancy or not? But my most important question is, I have multiple datasets and multiple columns that I need to convert to character. 4. Converting one column at a time doesn't seem an efficient way. Is there any better way I can do it?
... View more