Question

In: Statistics and Probability

In SAS, how do I extract the city, state, and zipcode into separate columns from a...

In SAS, how do I extract the city, state, and zipcode into separate columns from a single variable with all three?

Example-

Bremen, KS, 66412

Little River, KS, 67457

Bird City, KS, 67731

The above is stored in one variable each. But I want to make three separate variables with it. Some cities also have two words in it.

Solutions

Expert Solution

Solution-

Programm In SAS

/*Read the data and store in one datasets*/
data test;
infile cards dlm=',';
input City $ : 12. State $ Zipcode;
cards;
Bermen,KS,66412
Littel River,KS,67457
Bird City,KS,67731
;


/*Extarct variables one by one and store in datasets*/
/*Extact City*/
data City;
set Test(keep=City);
run;


/*Extact State*/
data State;
set Test(keep=State);
run;


/*Extarct Zipcode*/
data Zipcode;
set Test(keep=Zipcode);
run;


/*print the data*/
proc print data=test;
run;
proc print data=city;
run;
proc print data=state;
run;
proc print data=Zipcode;
run;

Output of the program


Related Solutions

How do I create a state of operations for healthcare?
How do I create a state of operations for healthcare?
how do I find the steady-state equation???
how do I find the steady-state equation???
How do I do this in R Studio? 1 Students who performed poorly on a City...
How do I do this in R Studio? 1 Students who performed poorly on a City of New York Skills Assessment Test were enrolled in a summer math program. Scores of 10 students before and after the summer program were recorded. They were: Before = 18,18,21,18,18,20,23,23,21,17 After = 24,25,33,29,33,36,34,36,34,27 (Scores for individual students are in the same order in each list.) Did the NYC summer math program improve student performance significantly? 8. How many points did student scores improve on...
Write code in SAS to do each of the following I have posted the data below...
Write code in SAS to do each of the following I have posted the data below from a pace delimited data set consisting of 66 randomly selected cars Upload the data set to SAS and store it as a SAS data set called cars. Make sure the full values are stored for all character variables. Create a comparative bar chart (with appropriate title and labels) displaying the brands of each car by fuel type (so that fuel type is on...
In statistics, how do you test independence using SAS programming?
In statistics, how do you test independence using SAS programming?
What are the elements of the corporate culture? How do the standards in SAS No. 55...
What are the elements of the corporate culture? How do the standards in SAS No. 55 and the work of COSO help to define a strong control environment?
How do you use header files on a program? I need to separate my program into...
How do you use header files on a program? I need to separate my program into header files/need to use header files for this program.Their needs to be 2-3 files one of which is the menu. thanks! #include #include #include using namespace std; const int maxrecs = 5; struct Teletype { string name; string phoneNo; Teletype *nextaddr; }; void display(Teletype *); void populate(Teletype *); void modify(Teletype *head, string name); void insertAtMid(Teletype *, string, string); void deleteAtMid(Teletype *, string); int find(Teletype...
How do we separate anxious or superstitious thoughts and behaviors from obsessions and compulsions?
How do we separate anxious or superstitious thoughts and behaviors from obsessions and compulsions?
How do we separate anxious or superstitious thoughts and behaviors from obsessions and compulsions?
How do we separate anxious or superstitious thoughts and behaviors from obsessions and compulsions?
For the operating cash flow for an expansion do I separate the details on the expansion....
For the operating cash flow for an expansion do I separate the details on the expansion. Example: Cash flow statement Revenue (existing) Less Cogs (existing) Less Expenses (existing) = gross profit Revenue (new) Less Cogs (new) Less Expenses (new) = gross profit Or, do I combine them both and use the below format Revenue (existing) Revenue (new) Less Cogs (existing) Less Cogs (new) Less Expenses (existing) Less Expenses (new) = gross profit
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT