06-22-2015 02:44 PM
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.
06-22-2015 03:19 PM
So what's your question? How to interpret the question?
06-22-2015 03:30 PM
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.
06-22-2015 03:40 PM
Hi Shelley- I think this is the second message you have copied- I am confused! Is there a better way I should address Reeze?
06-22-2015 03:51 PM
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.
SAS Online Community Manager
06-22-2015 04:10 PM
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.
06-22-2015 03:30 PM
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.
merge have1 (rename=(empid=ID))
06-22-2015 03:37 PM
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?
06-22-2015 03:58 PM
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: