BookmarkSubscribeRSS Feed
Reeza
Super User

I actually like this question as an interview question. It quickly demonstrates if a programmer understands a data step and by group functionality. It's definitely not something that's required but there are various reasons to do a running total or lagged data and this demonstrates both ideas.

 

Its also a very basic level of understanding and can easily verify if a programmers skill is at the level they claim during an interview process.

 

It's also kind of amusing when people don't even consider if their interviewers/testers are on the same forums and see the questions/answers. 

Sajid01
Meteorite | Level 14

Hello All.
This topic is very interesting and there is  a lot for me to learn.
I have a basic question, Please excuse me for my ignorance.
If the question has to be answered using data step only, can one use procs's for example proc means or proc sql ?

PaigeMiller
Diamond | Level 26

@Sajid01 

I think the problem SHOULD be answered by PROC SUMMARY/PROC MEANS or PROC SQL. I don't think people should program their own sums or means or other basic statistics by group in a DATA step. We have seen, in the SAS Communities, over and over again, people (usually with just a little experience in SAS) struggle to do this in a DATA step, and get it wrong, or they write code that doesn't work, or they write code that mis-handles missing values. Why spend the time writing DATA step code, debugging it, verifying it works, when SAS has already done this in PROC SUMMARY (and it works properly with missing values)???

--
Paige Miller
Reeza
Super User
"If the question has to be answered using data step only" is a an artificial limit that only exists in non work like situation, such as homework, class exams or tests before a job. And IMO, those situations are typically one where a user should be able to answer the question themselves without significant assistance of external users.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 18 replies
  • 1528 views
  • 6 likes
  • 7 in conversation