BookmarkSubscribeRSS Feed
VarunD
Obsidian | Level 7

Hello,

 

Is there a way to pull in values from specific cells of a spreadsheet and display them in a table.

For e.g. I have a spreadsheet that has :

 

Cell Address         -      Value

B16                       -      Toyota

D23                      -       Corolla

M45                     -        Honda

H-76                    -         Accord

 

Output that I am hoping for is :

A1                      -           Toyota

A2                      -           Honda

B1                      -           Corolla

B2                      -           Accord

 

TIA,

Varun

8 REPLIES 8
Reeza
Super User
You'll like need to explain more about what you're trying to do overall.
VarunD
Obsidian | Level 7

The input excel spreadsheet is not formatted like a table. But the values that I want to pull in have a specific cell address.

 

ChrisNZ
Tourmaline | Level 20

What do you call a table? A SAS data set? What are the column names?

VarunD
Obsidian | Level 7

The input excel spreadsheet is not formatted like a table.

By table I mean it doesn't have a column name. Values are spread across the sheet . Please see attachment.

 

Does that make sense ?

 

 

Reeza
Super User
No attachment is included. You can use DDE and/or read directly from a single cell, but it would be each cell going to a different data set. How do you know which cells to read? To read from a specific cell, use the RANGE option in PROC IMPORT and simply specify the single cell you want to read as a range.
VarunD
Obsidian | Level 7

Thanks for your help.

This is just an example I posted. I know what cells I need to look up and they will remain the same. 

I am aware of the PROC IMPORT option using range but my issue with it is that each import step will create a different data set.

And I want them to line up in a tabular form in the Output.

Reeza
Super User

@VarunD wrote:

Thanks for your help.

This is just an example I posted. I know what cells I need to look up and they will remain the same. 

I am aware of the PROC IMPORT option using range but my issue with it is that each import step will create a different data set.

And I want them to line up in a tabular form in the Output.


You can append them together after the fact. 

DDE is your other option or a Visual Basic script but both are using outside technologies.

 

 

ChrisNZ
Tourmaline | Level 20

Thanks for your help.

This is just an example I posted. I know what cells I need to look up and they will remain the same. 

I am aware of the PROC IMPORT option using range but my issue with it is that each import step will create a different data set.

And I want them to line up in a tabular form in the Output.

That's the easiest option as @Reeza said.

 

proc import  .. range..
proc import  .. range..
proc import  .. range..
data FINAL;
  merge XL1 (rename=(VAR=VAR1)) 
        XL2 (rename=(VAR=VAR2))
        XL3 (rename=(VAR=VAR3));
run;

 

 

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
  • 8 replies
  • 2305 views
  • 4 likes
  • 3 in conversation