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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 946 views
  • 2 likes
  • 4 in conversation