Hi everyone, I am very new to SAS 9.4, I have done some courses online but they don't seem to help with my current urgent issue and I would appreciate the help today if someone has a moment.
I have a B1 output which is fine however the BDM_HIST outputs are appearing in different columns and not in english, other sections of this code have a similar wording but the outputs have no issues so I'm not sure why this one is giving me an issue.
Has anyone seen this before? I have included a picture below.
This is the code
data b1;
infile "/proj/sas/sasdata/basesas/nonrisk/OnePath/InputFiles/bdm&iy.&im..csv"
dsd dlm = ';' missover firstobs = 2 linesize = 32767;
informat AR_Party_Key $18. Open_Acc ddmmyy10. close_acc ddmmyy10. Acc_Name $50. Dealer_grp $50. Strategic_AM $3. Member_type $19. OP_NB_Seg $4. Industry_NB_Seg $10.
Region $7. OP_Salesperson $37.;
format AR_Party_Key $18. Open_Acc ddmmyy10. close_acc ddmmyy10. Acc_Name $50. Dealer_grp $50. Strategic_AM $3. Member_type $19. OP_NB_Seg $4. Industry_NB_Seg $10.
Region $7. OP_Salesperson $37.;
input AR_Party_Key :$18. Open_Acc :anydtdte. close_acc :anydtdte. Acc_Name :$50. Dealer_grp :$50. Strategic_AM :$3. Member_type :$19. OP_NB_Seg :$4. Industry_NB_Seg :$10.
Region :$7. OP_Salesperson :$37.;
file_d = mdy(&im.,1,&iy_a.);
format file_d ddmmyy10.;
informat file_d ddmmyy10.;
run;
data bdm_hist;
set rladv.bdm_hist b1;
run;
data rladv.bdm_hist (compress = yes);
set bdm_hist;
run;
Okay I fixed it by creating a new name. Thank for your help
Maxim 3: Know Your Data.
The issue is with your existing dataset in library RLADV. In your second data step, the order of variables is taken from there (as the existing dataset appears first in the SET statement), and the old data is what is seen at the top of the viewtable of the concatenated data.
Hints: when code does not work as expected, the log is important (Maxim 2). Post your complete log by copy/pasting the text directly into a window opened with this button:
Similarly, use the "little running man" right next to it for your SAS code; this will keep all the formatting, the main posting window destroys it.
Thank you Kurt I really appreciate you coming back to me. I have previously deleted that dataset in the RLADV but then I get the error that it doesn't exist, then it creates a new one but it looks the same as the previous one.
33 libname rladv "/proj/sas/sasdata/basesas/nonrisk/OnePath/SASTables/Data/Retail/ADV"; NOTE: Libref RLADV was successfully assigned as follows: Engine: V9 Physical Name: /proj/sas/sasdata/basesas/nonrisk/OnePath/SASTables/Data/Retail/ADV 34 35 data _null_; 36 call symput('im',trim(left(month(intnx('month',today(),-1,'beginning'))))); 37 call symput('iy',substr(trim(left(year(intnx('month',today(),-1,'beginning')))),3,2)); 38 call symput('iy_a',trim(left(year(intnx('month',today(),-1,'beginning'))))); 39 run; NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 36:29 37:36 38:31 NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 40 2 The SAS System 17:52 Sunday, November 14, 2021 41 %put &im; 10 42 %put &iy; 21 43 %put &iy_a; 2021 44 Options datestyle=dmy; 45 46 /* ************************************************************************************************** */ 47 /* # 1 # - Submissions Tracker - BDM */ 48 /* ************************************************************************************************** */ 49 data b1; 50 infile "/proj/sas/sasdata/basesas/nonrisk/OnePath/InputFiles/bdm&iy.&im..csv" 51 dsd dlm = ';' missover firstobs = 2 linesize = 32767; 52 informat AR_Party_Key $18. Open_Acc ddmmyy10. close_acc ddmmyy10. Acc_Name $50. Dealer_grp $50. Strategic_AM $3. 52 ! Member_type $19. OP_NB_Seg $4. Industry_NB_Seg $10. 53 Region $7. OP_Salesperson $37.; 54 format AR_Party_Key $18. Open_Acc ddmmyy10. close_acc ddmmyy10. Acc_Name $50. Dealer_grp $50. Strategic_AM $3. 54 ! Member_type $19. OP_NB_Seg $4. Industry_NB_Seg $10. 55 Region $7. OP_Salesperson $37.; 56 input AR_Party_Key :$18. Open_Acc :anydtdte. close_acc :anydtdte. Acc_Name :$50. Dealer_grp :$50. Strategic_AM :$3. 56 ! Member_type :$19. OP_NB_Seg :$4. Industry_NB_Seg :$10. 57 Region :$7. OP_Salesperson :$37.; 58 file_d = mdy(&im.,1,&iy_a.); 59 format file_d ddmmyy10.; 60 informat file_d ddmmyy10.; 61 run; NOTE: The infile "/proj/sas/sasdata/basesas/nonrisk/OnePath/InputFiles/bdm2110.csv" is: Filename=/proj/sas/sasdata/basesas/nonrisk/OnePath/InputFiles/bdm2110.csv, Owner Name=symondsr,Group Name=gblunixdefault, Access Permission=-rw-r--r--, Last Modified=14Nov2021:12:30:05, File Size (bytes)=2167334 NOTE: 22234 records were read from the infile "/proj/sas/sasdata/basesas/nonrisk/OnePath/InputFiles/bdm2110.csv". The minimum record length was 54. The maximum record length was 139. NOTE: The data set WORK.B1 has 22234 observations and 12 variables. NOTE: DATA statement used (Total process time): real time 0.06 seconds cpu time 0.05 seconds 62 63 /*sas 7bdat file can be found:/proj/sas/sasdata/basesas/nonrisk/OnePath/SASTables/Data/Retail/ADV*/ 64 65 data bdm_hist; 66 set rladv.bdm_hist b1; 67 run; NOTE: There were 1744186 observations read from the data set RLADV.BDM_HIST. NOTE: There were 22234 observations read from the data set WORK.B1. NOTE: The data set WORK.BDM_HIST has 1766420 observations and 13 variables. NOTE: DATA statement used (Total process time): real time 1.17 seconds cpu time 0.75 seconds 3 The SAS System 17:52 Sunday, November 14, 2021 68 69 data rladv.bdm_hist (compress = yes); 70 set bdm_hist; 71 run; NOTE: There were 1766420 observations read from the data set WORK.BDM_HIST. NOTE: The data set RLADV.BDM_HIST has 1766420 observations and 13 variables. NOTE: Compressing data set RLADV.BDM_HIST decreased size by 42.70 percent. Compressed is 3589 pages; un-compressed would require 6264 pages. NOTE: DATA statement used (Total process time): real time 1.47 seconds cpu time 1.22 seconds
Okay I fixed it by creating a new name. Thank for your help
What do you mean by "new name"?
An accepted solution should be more specific, as other users having a similar problem need a description that allows them to apply the solution.
oh sorry
I changed the names from bdm_hist to bdm_hist1 I had to run it accouple of times as there was an error as the report was created it self but in the end it was created and looked as correct. I just had to go into the export destination file and rename it without the 1
So, instead of appending the data to an existing table, you created a new one with the imported data alone?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.