Hi! I have an assignment where I need to vertically combine data sets (set, not merge) and they are 12 separate csv files. I have imported the data but 2 variables are listed as both character and numeric variables. Their observations are reported numerically (height and alcohol, reported as number of drinks) so I would like to change both to character variables. I have been trying to complete this operation in the final data step where I combine all 12. I have previously tried creating new variables where I multiply the old variable by 1 and I have included my current code below. All 12 files have been imported without issue, I am now running into problems as I try to merge them. I am also using SAS studio and it says that there are 0 observations, despite there being 528 combined throughout the 12 data sets. Should I be looking for a solution in my data step or fixing each variable as I import the data? Thank you for your help! /*Example of last import, done successfully*/ proc import out=D12 datafile = '/home/u42933802/CM/DN012.csv' DBMS= csv replace; getnames=yes; run; /*Merge all files*/ libname CMEA '/home/u42933802/CM'; data final_data; set D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12; orig_var = 'Alcohol'; Drinks = input(Alcohol,8.); drop Alcohol; rename Drinks = Alcohol; orig_var = 'Height'; Centimeters = input(Height,8.); drop Height; rename Centimeters = Height; run; proc print data=final_data (obs=528); run; ERROR: Variable Height has been defined as both character and numeric. ERROR: Variable Alcohol has been defined as both character and numeric. ERROR: Variable Alcohol has been defined as both character and numeric. ERROR: Variable Alcohol has been defined as both character and numeric. ERROR: Variable Height has been defined as both character and numeric. ERROR: Variable Alcohol has been defined as both character and numeric. ERROR: Variable Alcohol has been defined as both character and numeric. ERROR: Variable Alcohol has been defined as both character and numeric. ERROR: Variable Alcohol has been defined as both character and numeric. ERROR: Variable Alcohol has been defined as both character and numeric. 74 75 orig_var = 'Alcohol'; 76 Drinks = input(Alcohol,8.); 77 drop Alcohol; 78 rename Drinks = Alcohol; 79 80 orig_var = 'Height'; 81 Centimeters = input(Height,8.); 82 drop Height; 83 rename Centimeters = Height; 84 85 run; NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 76:19 81:24 NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.FINAL_DATA may be incomplete. When this step was stopped there were 0 observations and 9 variables. WARNING: Data set WORK.FINAL_DATA was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.01 seconds memory 3974.68k OS Memory 36316.00k Timestamp 02/18/2020 10:49:16 PM Step Count 438 Switch Count 0 Page Faults 0 Page Reclaims 528 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 16 86 87 proc print data=final_data (obs=528); 88 run; NOTE: No observations in data set WORK.FINAL_DATA. NOTE: PROCEDURE PRINT used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 740.12k OS Memory 33196.00k Timestamp 02/18/2020 10:49:16 PM Step Count 439 Switch Count 0 Page Faults 0 Page Reclaims 65 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 0 89 90 91 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 102
... View more