BookmarkSubscribeRSS Feed
blackraven
Fluorite | Level 6

Hi.

If I merge two datasets where the first dataset does not include variable A and the second dataset includes the character variable A, then SAS will create a numeric variable A because this dataset was not set as the first dataset in the merge. Can I force SAS to keep A as a character variable although it is set as a second dataset in a merge?

data test;

set var_b_c textvar_a;

run;

If I have thousands of variables it is tricky to do it manually.

4 REPLIES 4
Linlin
Lapis Lazuli | Level 10

I don't think your statement is true. you should post some sample data.

blackraven
Fluorite | Level 6

I was truly surprised to see this, but it turned out I was too tired to notice value formatting was on. Thanks.

Ksharp
Super User

Change the order of these two datasets  ?

data test;

set  textvar_a  var_b_c;

run;

andreas_lds
Jade | Level 19

Unable to reproduce the error using SAS 9.2.

Code:


data work.WithoutName;

       set sashelp.class(drop=Name);

run;

data work.test;

       set work.WithoutName sashelp.class;

run;


proc print data=sashelp.vcolumn(where=

(memname = 'TEST' and upcase(name) = 'NAME'))

noobs;

       var libname memname memtype name type;

run;


Proc print shows:

libname memname memtype name type

WORK TEST DATA Name char

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
  • 943 views
  • 0 likes
  • 4 in conversation