From: n on
Hello all;

I am using proc sql to join two datasets in SAS 9.1.3.

The two datasets have a common variable 'category'. The variable has
the value 'A' in one dataset and 'B' in the other. I would like to
retain the variable in the new dataset but assign a new value, say
'C'.

Any suggestions as to how this could be done?

Kindly note that, I am not using this variable for merging and have
other variables which are sufficient to merge the two datasets.

Thanks and regards

n
From: Jan Klaverstijn on
n,

All sort of derived mappings are possible:

SELECT tab1.category as category, ...
FROM tab1, tab2
WHERE ....


or

SELECT CASE WHEN tab1.category='A' then 'C' ELSE tab2.category END as
category, ...
FROM tab1, tab2
WHERE ....

Explicitly pointing to category in either tab1 or tab2 might be the
pointer you were looking for.

Read the SAS SQL for what's possible. Which is a lot.

Have fun, Jan.

On 04-02-10 11:34, n wrote:
> Hello all;
>
> I am using proc sql to join two datasets in SAS 9.1.3.
>
> The two datasets have a common variable 'category'. The variable has
> the value 'A' in one dataset and 'B' in the other. I would like to
> retain the variable in the new dataset but assign a new value, say
> 'C'.
>
> Any suggestions as to how this could be done?
>
> Kindly note that, I am not using this variable for merging and have
> other variables which are sufficient to merge the two datasets.
>
> Thanks and regards
>
> n

 | 
Pages: 1
Prev: SQL update/insert
Next: proc phreg