Data :-
102563 $167.00 $125.00 $976.00 $483.00 $517.00 $797.00 $879.00 $988.00 $910.00 $451.00 $468.00 $236.00
Kindly help :-
my code :-
data Bill_Summary;
infile '/folders/myfolders/Jonty/Rawdata_files/Client_ID_12_months_bill.txt';
input client_ID $ January Dollar10.2 Febuary Dollar10.2 March Dollar10.2 April Dollar10.2 May Dollar10.2 June Dollar10.2 July Dollar10.2 August Dollar10.2 September Dollar10.2 October Dollar10.2 November Dollar10.2 December Dollar10.2;
run;
Answer depends upon whether you want to output records for all months or only those with non-missing balances. The following is for the latter:
data Bill_Summary (keep=client_ID balance month_num month_name); infile '/folders/myfolders/Jonty/Rawdata_files/Client_ID_12_months_bill.txt' truncover; informat month1-month12 Dollar10.2; input client_ID $ month1-month12; array months(*) month1-month12; do i=1 to dim(months); if not missing(months(i)) then do; balance=month(i); month_num=i; month_name=put(mdy(i,1,2017),monname.); output; end; end; run;
Art, CEO, AnalystFinder.com
Answer depends upon whether you want to output records for all months or only those with non-missing balances. The following is for the latter:
data Bill_Summary (keep=client_ID balance month_num month_name); infile '/folders/myfolders/Jonty/Rawdata_files/Client_ID_12_months_bill.txt' truncover; informat month1-month12 Dollar10.2; input client_ID $ month1-month12; array months(*) month1-month12; do i=1 to dim(months); if not missing(months(i)) then do; balance=month(i); month_num=i; month_name=put(mdy(i,1,2017),monname.); output; end; end; run;
Art, CEO, AnalystFinder.com
It's often a good idea to separate your formats from your INPUT statement. You can do it, but it's easier, IMO, to separate them out and then it tends to work as expected.
If you run a PROC IMPORT first, set GUESSINGROWS to a high number and then use/modify the code in the log as needed.
@jonty wrote:
- “Client_ID_12_months_bill.txt” contains the 12 months credit card bill against each client_id in single Import the data into SAS such that bill for each month is recorded as a separate observation and month number is also specific (Bonus question – Month name instead of month number)
- Import “Client_ID_12_months_bill(missing).txt” into SAS considering that there are churners in the data who left the company at different points of time during the year.
Data :-
102563 $167.00 $125.00 $976.00 $483.00 $517.00 $797.00 $879.00 $988.00 $910.00 $451.00 $468.00 $236.00
Kindly help :-
my code :-
data Bill_Summary;
infile '/folders/myfolders/Jonty/Rawdata_files/Client_ID_12_months_bill.txt';
input client_ID $ January Dollar10.2 Febuary Dollar10.2 March Dollar10.2 April Dollar10.2 May Dollar10.2 June Dollar10.2 July Dollar10.2 August Dollar10.2 September Dollar10.2 October Dollar10.2 November Dollar10.2 December Dollar10.2;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.