BookmarkSubscribeRSS Feed
Go
Quartz | Level 8 Go
Quartz | Level 8

how can i achieve below ? 

need sascode (loop code) to extract several data sets each having data of each city from a large dataset  which has a column/header as CITY ???

 

2 REPLIES 2
ballardw
Super User

What is the name of your source data set?

What is to be the name of the resulting data set?

How do we know which information (records to extract, records with values of ??? for City)?

What does the result look like?

What will you do with the multiple data sets after extraction?

 

 

Many times there may be absolutely no need to extract data at all and usually extracting into multiple data sets based on the value of one or more variables may cause more work than a different approach.

SAS has a feature called "By Group processing" which means you can make a separate report by the value of one or more variables such as BY CITY from a large data set. You can restrict the data to a reduced set of records with a WHERE statement such as: Where city in ('New York' 'Chicago' 'Memphis') to process data only from those cities.

 

BTW be careful with variables like City as many cities have more than one when state (or province or other sub-region) is considered. Springfield for example is in 24 states or protectorates.

Tom
Super User Tom
Super User

I seem to remember that there are three Springfields in Pennsylvania.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 653 views
  • 2 likes
  • 3 in conversation