Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access one cell in a database and make the value equal to a variable

Status
Not open for further replies.

Katie6

Programmer
Jun 12, 2007
58
GB
I have a data set with the following headings:

- name
- address
- ID

I have got a bit of code like this:
Code:
data new;
set details; 
where (ID = '123456');
run;

proc print data = new;
run;
This brings back the name address and ID of the person with ID 123456, i.e. it brings back 1 row.

However, I don't want the whole row. I only want one cell - the name. I then want to make the value of that cell equal to the variable Name.

(I don't want to use proc print for this - I just used it as an illustration. Eventually I will display the value of the Name variable on a webpage so that when the person enters their ID, it will bring back the message "hello &name").

Would anyone be able to assist me with this?

Many thanks for your help,

Katie
 
Perhaps you can elabrate on what you plan on doing. As I don't understand why you care if SAS or any other database returns more columns than you need. You could easily pick and choose what gets displayed on any output. Including a web page.
perhaps you mean to create a dynamic column such as this:

ex:
Code:
message = "Hello " ||trim(name);

Then you display the 'message' variable.

On another note why are you using SAS to drive a webpage? While SAS can deliver web page content it shouldn't be used as a web driver. It was never designed for that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top