I have a dataset that I brought in using PROC IMPORT that I called SOWED. It was 9 variables in that dataset and I want to use those 9 variables to create 70 other variables in a new dataset that I'm calling SOWED1.
However, I want the 70 variables to each have a length of 100 (character) and want two of the variables to have a date format. So in short: I want to create a new dataset using the old dataset but want to have a lengths and formats specified. The problem is nothing happens when I run the data step. Nothing in the log and nothing in my output. This seems to happen because of my length and format statements because when I take them out, the data step runs and I get a log and output. What am I doing wrong?
data sowed1;
format graduation_year year4. university_thru_date mmddyy10.;
length
newvar1
newvar2
newvar3
...
newvar70
$ 100;
set SOWED;
run;
How did you "import" the original data? If the original file is a text file, like a CSV file, then just write your own data step to read it and you can create the variables the way you want the first time.
" Nothing in the log and nothing in my output."-- That sounds a bit vague. Can you please try restarting your system and run the code again in piecemeal.
Once you have successfully imported SOWED, please take a look at the PROC CONTENTS and PROC PRINT restricting to 50 records (OBS=50) to check if the dataset SOWED import worked as expected.
Also, you could post your full code and the log.
Most likely your LENGTH or FORMAT statements contain a opening comment or quote characters without closing them. Remove unmatched characters such as these /* */ ' " *
How did you "import" the original data? If the original file is a text file, like a CSV file, then just write your own data step to read it and you can create the variables the way you want the first time.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.