-
Notifications
You must be signed in to change notification settings - Fork 21
Added Data_Step_Select example #35
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
Conversation
Signed-off-by: Kevin-Boone-SAS <kevin.boone@sas.com>
Hi Kevin - Just curious, what do you think of also adding this code into the sample program so that users can see there is the option to list multiple values in each WHEN clause? data work.cars_orig_country; /1/ |
Hi Stacey,
Sounds good to me. In fact, you just taught me something – I had never tried with multiple values in WHEN. 😲
Will you make the update or do you want me to?
- Kevin
From: Stacey Syphus ***@***.***>
Sent: Monday, April 21, 2025 2:59 PM
To: sassoftware/sas-code-examples ***@***.***>
Cc: Kevin Boone ***@***.***>; Author ***@***.***>
Subject: Re: [sassoftware/sas-code-examples] Added Data_Step_Select example (PR #35)
Hi Kevin -
Just curious, what do you think of also adding this code into the sample program so that users can see there is the option to list multiple values in each WHEN clause?
data work.cars_orig_country; /1/
set sashelp.cars(keep=Make Model Origin); /2/
length Origin_Country $25; /3/
select (Make); /4/
when ('Acura', 'Honda', 'Infiniti', 'Isuzu', 'Lexus', 'Mazda', 'Mitsubishi', 'Nissan', 'Scion', 'Subaru', 'Suzuki', 'Toyota')
Origin_Country = 'Japan'; /5/
when ('Hyundai', 'Kia')
Origin_Country = 'South Korea';
when ('Audi', 'BMW', 'Mercedes-Benz', 'Volkswagen', 'Porsche')
Origin_Country = 'Germany';
when ('Jaguar', 'Land Rover', 'MINI')
Origin_Country = 'England';
when ('Saab', 'Volvo')
Origin_Country = 'Sweden';
when ('Buick', 'Cadillac', 'Chevrolet', 'Chrysler', 'Dodge', 'Ford', 'GMC', 'Hummer', 'Jeep', 'Lincoln', 'Mercury', 'Oldsmobile', 'Pontiac', 'Saturn')
Origin_Country = 'United States of America';
otherwise Origin_Country = ''; /6/
end; /7/
rename Origin = Origin_Region; /8/
run;
—
Reply to this email directly, view it on GitHub<#35 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BRTJBURC3AKMXIUETRZ7FDD22U5XDAVCNFSM6AAAAAB3R2CBOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJZGI3DMOJZG4>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
[https://avatars.githubusercontent.com/u/22669486?s=20&v=4]stever-sas left a comment (sassoftware/sas-code-examples#35)<#35 (comment)>
Hi Kevin -
Just curious, what do you think of also adding this code into the sample program so that users can see there is the option to list multiple values in each WHEN clause?
data work.cars_orig_country; /1/
set sashelp.cars(keep=Make Model Origin); /2/
length Origin_Country $25; /3/
select (Make); /4/
when ('Acura', 'Honda', 'Infiniti', 'Isuzu', 'Lexus', 'Mazda', 'Mitsubishi', 'Nissan', 'Scion', 'Subaru', 'Suzuki', 'Toyota')
Origin_Country = 'Japan'; /5/
when ('Hyundai', 'Kia')
Origin_Country = 'South Korea';
when ('Audi', 'BMW', 'Mercedes-Benz', 'Volkswagen', 'Porsche')
Origin_Country = 'Germany';
when ('Jaguar', 'Land Rover', 'MINI')
Origin_Country = 'England';
when ('Saab', 'Volvo')
Origin_Country = 'Sweden';
when ('Buick', 'Cadillac', 'Chevrolet', 'Chrysler', 'Dodge', 'Ford', 'GMC', 'Hummer', 'Jeep', 'Lincoln', 'Mercury', 'Oldsmobile', 'Pontiac', 'Saturn')
Origin_Country = 'United States of America';
otherwise Origin_Country = ''; /6/
end; /7/
rename Origin = Origin_Region; /8/
run;
—
Reply to this email directly, view it on GitHub<#35 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BRTJBURC3AKMXIUETRZ7FDD22U5XDAVCNFSM6AAAAAB3R2CBOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJZGI3DMOJZG4>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
I'm a lazy programmer, so I'm always looking for shortcuts. :) I don't mind making the change. I'll merge the request, then update the program. I'll make a couple of other edits that I'll mention here for future reference:
|
Thank you. I thought I had grabbed the latest version of the documentation, sorry if I didn't. Note that CALCULATED COLUMNS (uppercase) also appears in DATA Step > Compute new columns...sas so it's probably worth changing it there, too.
- Kevin
From: Stacey Syphus ***@***.***>
Sent: Monday, April 21, 2025 3:18 PM
To: sassoftware/sas-code-examples ***@***.***>
Cc: Kevin Boone ***@***.***>; Author ***@***.***>
Subject: Re: [sassoftware/sas-code-examples] Added Data_Step_Select example (PR #35)
I'm a lazy programmer, so I'm always looking for shortcuts. :) I don't mind making the change. I'll merge the request, then update the program. I'll make a couple of other edits that I'll mention here for future reference:
* I'll take out EXAMPLE from the program title in the comment and make the program file name and title match.
* I'll update the doc link to use the default URL that will always point to the latest version of the page.
* I'll change "CASE statement" to "CASE expression" to be consistent with SQL terminology.
* I'll change CALCULATED COLUMN to lower case in the keyword list (syntax keywords are in caps, topic keywords are lower) and I'll add 'calculated column' to the kewords.txt file.
-
Reply to this email directly, view it on GitHub<#35 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BRTJBUUJCTC3M5A6ROWIA3L22U765AVCNFSM6AAAAAB3R2CBOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJZGMYDIMZSGI>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
[https://avatars.githubusercontent.com/u/22669486?s=20&v=4]stever-sas left a comment (sassoftware/sas-code-examples#35)<#35 (comment)>
I'm a lazy programmer, so I'm always looking for shortcuts. :) I don't mind making the change. I'll merge the request, then update the program. I'll make a couple of other edits that I'll mention here for future reference:
* I'll take out EXAMPLE from the program title in the comment and make the program file name and title match.
* I'll update the doc link to use the default URL that will always point to the latest version of the page.
* I'll change "CASE statement" to "CASE expression" to be consistent with SQL terminology.
* I'll change CALCULATED COLUMN to lower case in the keyword list (syntax keywords are in caps, topic keywords are lower) and I'll add 'calculated column' to the kewords.txt file.
-
Reply to this email directly, view it on GitHub<#35 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BRTJBUUJCTC3M5A6ROWIA3L22U765AVCNFSM6AAAAAB3R2CBOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJZGMYDIMZSGI>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
You did include the 2025.04 link - thank you! I will still change the URL so that it automatically opens the latest version of the page, so next month it will open to 2025.05. If you want to do this yourself in future programs, plug the URL for the doc page into this internal app: https://docportal.unx.sas.com/url-conversion/. Then grab the Production link under Default URLs. |
Nice! Thanks for that tip.
- Kevin
From: Stacey Syphus ***@***.***>
Sent: Monday, April 21, 2025 3:30 PM
To: sassoftware/sas-code-examples ***@***.***>
Cc: Kevin Boone ***@***.***>; Author ***@***.***>
Subject: Re: [sassoftware/sas-code-examples] Added Data_Step_Select example (PR #35)
You did include the 2025.04 link - thank you! I will still change the URL so that it automatically opens the latest version of the page, so next month it will open to 2025.05. If you want to do this yourself in future programs, plug the URL for the doc page into this internal app: https://docportal.unx.sas.com/url-conversion/. Then grab the Production link under Default URLs.
-
Reply to this email directly, view it on GitHub<#35 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BRTJBUTGKVHUJFBT2KTLJ3T22VBKFAVCNFSM6AAAAAB3R2CBOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJZGMZDSMZSG4>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
[https://avatars.githubusercontent.com/u/22669486?s=20&v=4]stever-sas left a comment (sassoftware/sas-code-examples#35)<#35 (comment)>
You did include the 2025.04 link - thank you! I will still change the URL so that it automatically opens the latest version of the page, so next month it will open to 2025.05. If you want to do this yourself in future programs, plug the URL for the doc page into this internal app: https://docportal.unx.sas.com/url-conversion/. Then grab the Production link under Default URLs.
-
Reply to this email directly, view it on GitHub<#35 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BRTJBUTGKVHUJFBT2KTLJ3T22VBKFAVCNFSM6AAAAAB3R2CBOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJZGMZDSMZSG4>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
See Data_Step_Select.sas in the By Syntax>DATA Step folder.
Signed-off-by: Kevin Boone kevin.boone@sas.com