Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data input problem

Status
Not open for further replies.

twylite

Programmer
Apr 8, 2009
2
US
Hi all, have data in the following format:

X Y Z Count
1 0 1 2
1 1 0 1
0 1 1 2

which i need to translate to:

X Y Z
1 0 1
1 0 1
1 1 0
0 1 1
0 1 1

Whats the most efficient way to do this in sas, I had assumed there was a built in way in the data step but I havent found it. Any help would be appreciated.
 
This should work.

Code:
data have;
  input x y z count ;
  datalines;
1 0 1  2
1 1 0  1
0 1 1  2

;
run;

Data want;
set have;
do i=1 to count;
    output; 
end;
run;

You can add (drop=count i) right behind Want to remove those 2 variables.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top