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

I copied a table from a pdf file that contained Exam Code and Exam Name and pasted it into Excel. The results were pasted into one column instead of two separate ones.  I want to read the data like so:

 

Data I want:

Exam_Code   Exam_Name

7                     United States History

13                   Art History

14                   Studio Art: Drawing Portfolio

.

.

.

 

Data I have in Excel. (I also pasted it into Notepad with similar results).

 

7
United States History
13
Art History
14
Studio Art: Drawing Portfolio
15
Studio Art: 2-D Design Portfolio
16
Studio Art: 3-D Design Portfolio
1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

@GreggB: Then why not just input it the same way, i.e.:

 

data want;
  informat Exam_Name $50.;
  input Exam_Code/  Exam_Name &;
  cards;
7
United States History
13
Art History
14
Studio Art: Drawing Portfolio
;

Art, CEO, AnalystFinder.com

View solution in original post

4 REPLIES 4
art297
Opal | Level 21

@GreggB: Then why not just input it the same way, i.e.:

 

data want;
  informat Exam_Name $50.;
  input Exam_Code/  Exam_Name &;
  cards;
7
United States History
13
Art History
14
Studio Art: Drawing Portfolio
;

Art, CEO, AnalystFinder.com

Reeza
Super User

If you have Adobe Professional it can convert the doc to Excel or Word and will save the formatting, at least better than copy and paste. 

 

If you don't have Adobe Professional, you can use the second file, the txt file and easily read that in using SAS. 

 

data want;

infile 'path to text file' truncover;

input number / name $20.;

run;

 

 

ballardw
Super User

Not actually a SAS related question.

You likely need a PDF viewer/editor that has a "Copy TABLE" option to maintain the "columns" in the PDF table. If the PDF data is NOT a table then you're likely going to have a lot of work if you want the result in Excel.

 

Note that SAS can read that pasted text file (notepad) with a proper data step. Something like

data want;

   infile 'c:\path\filename.txt' truncover;

   informat exam_code best5. exam_name $50.;

   input exam_code

            /exam_name 1-50;

run;

GreggB
Pyrite | Level 9

I don't want the result in Excel. I was just trying to think of a way to get SAS to read it. I should have pasted directly to the text editor.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 1263 views
  • 2 likes
  • 4 in conversation