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???
From looking at the traceroute underneath, how can I know what city the message city it...
From looking at the traceroute underneath, how can I know what city the message city it leaves and what city it lands in Europe? traceroute: Warning: bbc.uk.com has multiple addresses; using 212.58.244.210 traceroute to bbc.uk.com (212.58.244.210), 64 hops max, 72 byte packets 1 192.168.123.1 (192.168.123.1) 5.746 ms 2.225 ms 2.113 ms 2 192.168.219.1 (192.168.219.1) 260.894 ms 2.280 ms 2.845 ms 3 116.36.195.65 (116.36.195.65) 3.044 ms * 217.889 ms 4 10.204.106.165 (10.204.106.165) 4.215 ms 3.389 ms 3.619 ms 5 1.213.1.149 (1.213.1.149)...
C++... How do I separate a C String, entered by a user, by commas? Say they...
C++... How do I separate a C String, entered by a user, by commas? Say they enter Frog,Wolf,Spider... I want a array containing the elements {Frog, Wolf, Spider} thanks Here's my idea so far... cout << "Enter the column names (c of them), each name seperated by a comma" << endl; char colNames[100]; cin >> colNames; for (int i = 0; i < 99; ++i){ if (colNames[i] == ','){ //parse the string, assign that string name to that column }...
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?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT