BookmarkSubscribeRSS Feed
rbs_LISER
Calcite | Level 5

Hello this is my 2nd/4 questions:

I am trying to understand the named question above. I am posting it below for convenience:

Renaming (in SAS) some variables of 2 datasets before horizontally merging them. When is it necessary? How to do that within the merging data step itself?


I am expected to format my answers by including the following:



a) find out, for each issue, between 3 and 5 interesting documentation sources (eg SAS User's manuals, SAS course notes, archives of the SAS-L list, forums like SAS communities, SUGI papers, blogs on SAS, courses offered on university sites,...) explaining how to deal efficiently with this issue

b) for each issue, give all the possible answers, explaining their relative characteristics and advantages, indicating the sources where the information was found.

c) for each issue, the final synthesis should be very clear, proofread and potentially useful for people looking for explanations about the way to deal with the data management issues at stake, using SAS. It implies that, for each issue, the assignment should start with a brief explanation of what the issue is, then explain how to deal with this issue, and end with at least two short examples (easy to understand and to replicate) with comments between /* */.

I appreciate comprehensive help, as these answers will enable better understanding and better performance on my upcoming exam.

Kind regards!

10 REPLIES 10
rbs_LISER
Calcite | Level 5

Hello again, Reeza. Yes, how to interpret the question and how to best and most efficiently perform the task, including the "when is it necessary" part of the question. If you have an interesting sources for answers to questions like the ones I have posted, that too would be very helpful.

rbs_LISER
Calcite | Level 5

Hi Shelley- I think this is the second message you have copied- I am confused! Is there a better way I should address Reeze?

ShelleySessoms
Community Manager

No, you're doing everything correctly. Because there are multiple questions and replies, I am moderating them as they come in. Things may look a little out of whack until everything gets approved for posting. Just keep going, we'll get your questions/replies out as quickly as possible.

Thanks,

Shelley

SAS Online Community Manager

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Reeza
Super User

Search LexJansen.com - there a many many papers on most of these topics with various solutions but you'll have to aggregate them together to get what you want.

dcruik
Lapis Lazuli | Level 10

Renaming your variables are necessary when the variables will be used in a data step merge and will be the variables being merged on in the BY statement.  Otherwise, you'll have to use a SQL Procedure to merge the two data sets (doesn't require the variable being merged on to have same name).  You can rename the variable(s) in your merge statement of the data step merge by using the (rename=(newvar=oldvar)).  Data step merges require that the variables you are merging the two data sets on have the same format and name and are sorted by that variable before merging.

data want;

merge have1 (rename=(empid=ID))

have2;

by ID;

run;

rbs_LISER
Calcite | Level 5

Thank you dcruik. I appreciate this very much. Where can I look for more examples? For example, like an annotated output? Or syntax with comments explaining the steps?

dcruik
Lapis Lazuli | Level 10

I would highly recommend getting onto the SAS Support website and looking around there for a lot of good syntax and examples of questions you may have, as they have a great support website that I use often when researching issues and techniques to use (I would just use the search bar at the following website and there are tons of documentation with syntax and examples explainig different procedures and techniques): https://support.sas.com/

Many times just googling issues and different thins in SAS will take you to the support.sas.com URL.

This would be a useful source for your data merging and introducing how to use it and the basics:

http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001304305.htm

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!

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.

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
  • 10 replies
  • 871 views
  • 0 likes
  • 4 in conversation