Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect or warn when sort is needed or assummed #42

Open
dwhollick opened this issue Apr 8, 2024 · 0 comments
Open

Detect or warn when sort is needed or assummed #42

dwhollick opened this issue Apr 8, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@dwhollick
Copy link

/* summarize sashelp.class with one row per age and a variable called "namelist" containing a comma delimited list of names */
Select Generate Code.

The generated DATA step logic is correct but will not run as-is because the input data set is not sorted by AGE. The system should check if the dataset is already sorted by age or if an index is defined on age. If not, it should add a proc sort to the generated code.

Or, at a minimum, the user should be warned that the generated code assumes a sorted order.

data summarized_class;
set sashelp.class;
by age;
length namelist $200;
retain namelist;

if first.age then namelist = name;
else namelist = catx(",", namelist, name);

if last.age then output;
drop name;

format namelist $200.;
run;

@dwhollick dwhollick added the enhancement New feature or request label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants