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

I'm sure this is an easy one and I'm doing something dumb, but for some reason I can only get the first line into the work.have dataset. What am I doing wrong? 

 

 data WORK.have;
   infile datalines dsd truncover;
   input Name:$20. Car:$30. Date_of_Service: mmddyy10.;
   format Date_of_service mmddyy10.;
 datalines;
Henry O'Toole, '86 Chevy Celebrity, 01052018
Henry O'Toole, '86 Chevy Celebrity, 04092018
Henry O'Toole, '86 Chevy Celebrity, 07122018
Henry O'Toole, '86 Chevy Celebrity, 10142018
Henry O'Toole, '07 Toyota Prius, 01162018
Henry O'Toole, '07 Toyota Prius, 04202018
Henry O'Toole, '07 Toyota Prius, 07232018
Henry O'Toole, '07 Toyota Prius, 10252018
Kathleen Boberts, '96 Honda Accord, 01272018
Kathleen Boberts, '96 Honda Accord, 05012018
Kathleen Boberts, '96 Honda Accord, 08032018
Kathleen Boberts, '96 Honda Accord, 11052018

 ;
 run;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Post the log from when you try to run it.  Copy the lines from the log and paste them into this forum using the pop-up window that appears when you use the Insert Code icon (looks like {i} on the menu bar) to preserve the relative positions of the characters.

 

A few things to check.

1) Make sure to get a fresh SAS session for your EG.  Perhaps earlier code has left SAS in an unstable state and the code you are submitting is not being seen be SAS properly.  You might have submitted unbalanced quotes. You might have set system option OBS to 1.

2) Make a new simple data step that reads from datalines and type it into the EG editor by hand.  Does that work?

3) Copy the code out of EG into a simple text editor like Windows Notepad and make sure that it is not all one long line.  Perhaps the EG editor is just wrapping the long lines to make it look like there are multiple lines?  Then paste it back into EG.

4) Re type the program and two or more lines of data by hand into EG and try running that.

 

 

View solution in original post

5 REPLIES 5
ballardw
Super User

When I run your code I get 13 rows of data, including a final one with all missing values (poor form in data lines to have blank line).

 

However, that is after copy and paste into a different system.

I see that your pasted code shows a yellow highlight before the word datalines and the semicolon following, plus the semicolon ending the datalines is highlighted.

 

That may indicate some sort of not normally visible character has snuck into your code. This sometimes happens when copying code from other sources.

Try deleting the entire line with datalines; and retyping from scratch. Do the same with the ending semicolon and remove the blank line.

 

Then try rerunning the code.

 

theponcer
Quartz | Level 8

Haha, I copied from your code! I will try running it on Base SAS instead of EG. 

"Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against."

 

*Edit: This code IS working in Base SAS (after deleting the space at the end), but is NOT working in EG. In EG, it only outputs the first observation. 

Tom
Super User Tom
Super User

Post the log from when you try to run it.  Copy the lines from the log and paste them into this forum using the pop-up window that appears when you use the Insert Code icon (looks like {i} on the menu bar) to preserve the relative positions of the characters.

 

A few things to check.

1) Make sure to get a fresh SAS session for your EG.  Perhaps earlier code has left SAS in an unstable state and the code you are submitting is not being seen be SAS properly.  You might have submitted unbalanced quotes. You might have set system option OBS to 1.

2) Make a new simple data step that reads from datalines and type it into the EG editor by hand.  Does that work?

3) Copy the code out of EG into a simple text editor like Windows Notepad and make sure that it is not all one long line.  Perhaps the EG editor is just wrapping the long lines to make it look like there are multiple lines?  Then paste it back into EG.

4) Re type the program and two or more lines of data by hand into EG and try running that.

 

 

Tom
Super User Tom
Super User

How are you submitting the code? 

Are you using interactive SAS (aka Display Manager)? 

SAS Enterprise Guide?

SAS/Studio? 

Running from the command line using a source file with the SAS code?  What editor did you use to create the program file?

 

What version of SAS are you running?

 

What operating system is SAS running on (not where EG or SAS/Studio is running but where the SAS server they are connected to is running).

 

theponcer
Quartz | Level 8

I'm using SAS Enterprise Guide, and submitting the code using the "Run Selection" option. I used the Generic SAS Editor to create the code. 

 

Current version: 9.04.01M5P091317

Operating System: LIN X64

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 1654 views
  • 1 like
  • 3 in conversation