BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
InspectahDex
Obsidian | Level 7

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.

View solution in original post

5 REPLIES 5
novinosrin
Tourmaline | Level 20

" 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. 

SASKiwi
PROC Star

Most likely your LENGTH or FORMAT statements contain a opening comment or quote characters without closing them. Remove unmatched characters such as these /* */ ' " * 

Reeza
Super User
If all your variables have the same prefix you can list them as newvar1-newvar70, you don't need to manually list them all.
Tom
Super User Tom
Super User

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.

InspectahDex
Obsidian | Level 7
The file was xlsx. I changed it to CSV and it worked!

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1009 views
  • 2 likes
  • 5 in conversation