Recent Activity
Hi We have SAS installed on our local computer (Windows), and when I batch the program (right-click on the program and there is an option called "open with > sas 9.4 for windows" the log and lst are not getting outputted to the directory the program is running in, instead they are outputting to directory shown in the screenshot. Can any of you have any ideal on how we can make sure, when running the program, the log and lst files are outputted in the same directory? I understand that we can using CMD prompt to batch the programs and that options seems working, but we wanted to figure out how we can achieve it this way. Thank you for your time.
... View more

0
6
back to this subject I am now beyond the READ DATA issues, I guess. However, when I run the code I got two data errors as in the files attached and a semantic error from the solver. I tried both options, using the smallest function and the percentile. The result is the same. Also, the expand does not show the objective function, but shows the constraints just fine. The main difficulty, I guess, is that when optimising I do not need the commodities anymore (COMMS), just the date. Any help? Thanks, Marcio. this is the code: DATA max_limits; input ativo $ val_max; datalines; Nickel 5.5 Tin 2.2 ; run; %let max_metals=6.0; /* The following are not used yet since we are validating the model with only two metal commodities */ %let max_agri=12; %let max_total=20; PROC OPTMODEL; /* Read historic and constraints table from WORKLIB */ /* LIM_METALS contains the max values by asset/period and the max of total assets by type (in this case METALS) per period */ set <str> PERIODS = /_1M _3M _6M _9M _1Y _2Y _3Y/; set <str> COMMS; set <num> DATES; set <num,str> DATES_COMMS; num lim_metals {COMMS, PERIODS}; num hist_data {DATES_COMMS, PERIODS}; num val_max{COMMS}; read data WORK.LIM_METAL into COMMS=[commodity] {j in PERIODS} <lim_metals[commodity, j]=col(j)>; print lim_metals; read data max_limits INTO COMMS=[ativo] val_max; print val_max; read data WORK.HIST_VAR_4 INTO DATES_COMMS=[date ativo] {p in PERIODS} <hist_data[date,ativo,p]=col(p)>; print hist_data; /* Variables to optimise and constraints */ /* The goal is to minimise the value at risk by calculating the amount allocated to each asset (Nickel and Tin) for each period. */ var amount{COMMS, PERIODS} >= 0; /* Corrected IMPVAR definitions */ impvar amount_data {date in DATES, comm in COMMS, p in PERIODS} = amount[comm, p] * hist_data[date, comm, p]; impvar amount_date_comm_period {date in DATES} = sum{comm in COMMS, p in PERIODS} amount_data[date, comm, p]; impvar total_comm {comm in COMMS} = sum{period in PERIODS} amount[comm, period]; /* Constraints */ con lim_comm {comm in COMMS}: total_comm[comm] <= val_max[comm]; con lim_total: sum{comm in COMMS} total_comm[comm] <= &max_metals; expand; /* Objective Function */ /* For 99% VaR (6th smallest value in the sample of 520 obs) */ /* min value_at_risk = pctl(.99, of amount_date_comm_period[*]);*/ min value_at_risk1= smallest(6, of amount_date_comm_period[*]); solve with nlp / algorithm=as ms; print amount; print value_at_risk1; quit;
... View more

0
2
Hi All I am using SAS EG 8.2. Please help! How can I create the attached excel sheet calculation in SAS? At each change of the number & at the end of the month I want to build in a line that says "INTEREST" in the tran_type column with the calculation under "AMOUNT1". The calculation for "AMOUNT1" will always reference the first line of that account that reads "INTEREST" at the top subtract the number in amount1 & also subtracting the unearned_bal that I get from another table. Now when the next month arrives, the calculation must do the same but instead subtract the new unearned_bal for the month from the first line
... View more

0
4
It has been a while since I have discussed the topic of time series. I think it is about time that we revisited this analysis using SAS Visual Forecasting functionality in the Model Studio area of SAS Viya. In this time of big data, the amount of time series that may need to be analyzed is growing. SAS Visual Forecasting is a great tool for assisting with quickly modeling many series with minimal interaction from you. However, there will always be high value series that warrant extra time and focus to obtain the best forecasting model possible. In this post, we will discuss how you can leverage your knowledge of the business and data to improve forecasts for high value series via the Interactive Modeling Node within SAS Visual Forecasting.
... View more

- Find more articles tagged with:
- forecasting
- GEL
- sas model studio
- SAS Visual Forecasting
0
0
I have written a lot of macros over the past that utilize pipe commands as in the code box below. The date from the dir commands has always been in MM/DD/YYYY for me. This has worked fine for quite some time because everyone that uses my code is either in the US or India, and we have all had our computers set to this format. However, we have been bringing in users from the UK, and they all set their systems to be DD/MM/YYYY. When they run my code, this pipe command swaps the day and month, and then I get invalid notes in my log because they don't consider 29/04/2025 to be a valid date. Visually, I can tell that this is April 29, but since my code is set up to read it as MM/DD/YYYY, it doesn't know what the 29th month is.
With all that background, is there a way to easily tell which format the value is in? I can set up some IF statements such that if the first 2 digits are greater than 12, then I know it's in DD/MM/YYYY format, or if the second 2 digits are greater than 12, then I know it's in MM/DD/YYYY format. However, if both are less than or equal to 12, I won't know. 04/03/2025 could be March 4 or April 3. Has anyone dealt with this scenario before?
filename SASlist pipe "dir /t:w &datapath.\*.sas7bdat";
data datadir;
infile SASlist dlm="¬";
length buff $2000;
input buff;
if _n_>3 & index(buff,"File")=0 & index(buff,"Dir")=0 then do;
date=input(scan(buff,1,''),mmddyy10.);
file=scan(buff,-1,'');
dset=upcase(scan(file,1,'.'));
end;
format date date9.;
run;
... View more

0
8
Unanswered topics
These topics from the past 30 days have no replies. Can you help?