View Single Post
  #65  
Old 06-18-2011, 06:20 PM
ZeroUrashima ZeroUrashima is offline
Member
 
Join Date: Apr 2010
Posts: 30
Default

Currently reading Learning SAS by Example: A Programmer's Guide and doing the questions...

I am doing Chapter 21's Question 10 and I wrote the thing that way:
Code:
data SALES INVENTORY;
input @16 Type 1. @;

if Type=1 then do;
	input @1 Date mmddyy10.
		  @12 Amount 4.;
	output Sales;
end;

else if Type=2 then do;
	input @1 PartNumber $6.
		  @8 Quantity 3.;
	output Inventory;
end;

drop type;

datalines;
10/21/2005  1001
11/15/2005  2001
A13688 250     2
B11112 300     2
01/03/2005 50001
A88778 19      2
;
run;

title "Listing of SALES";
proc print data=Sales;
run;

title "Listing of INVENTORY";
proc print data=inventory;
run;
Question asks to create two SAS data sets in one DATA Step and the result they want only have the columns that have non-missing Data.

Currently, Sales have a column of PartNumber and Quantity and Inventory has a column of Date and Amount. I suppose I could use var in the procedure to get rid of those but I don't think that's what the question wants since they are still in the Data Set but we just don't see them. Anyone can tell me if there is a way to create 2 Data Sets in one Data Step and the columns with missing values are not there?
Reply With Quote
 
Page generated in 0.21585 seconds with 9 queries