09-01-2015
RichardinOz
Quartz | Level 8
Member since
10-01-2012
- 644 Posts
- 0 Likes Given
- 1 Solutions
- 409 Likes Received
-
Latest posts by RichardinOz
Subject Views Posted 1043 09-14-2014 08:41 AM 2890 09-12-2014 09:30 AM 791 09-12-2014 09:27 AM 2890 09-12-2014 09:01 AM 2890 09-10-2014 07:35 AM 5171 09-07-2014 03:20 AM 596 09-05-2014 07:21 PM 147732 09-05-2014 06:58 PM 2111 08-26-2014 08:50 AM 508 08-24-2014 10:58 AM -
Activity Feed for RichardinOz
- Got a Like for Re: How to count nonmissing number of observations. 04-22-2024 03:05 AM
- Got a Like for Re: proc format:error. 07-31-2023 10:40 AM
- Got a Like for Re: Working with single quotes and double quotes. 05-22-2023 02:46 PM
- Got a Like for Re: Merge duplicate records in SAS. 07-13-2021 01:19 PM
- Got a Like for Re: What is the difference between Class and by statement in PROC MEANS?. 03-15-2021 07:50 PM
- Got a Like for Re: Excel PivotTable connected to SAS tables. 02-14-2021 12:21 PM
- Got a Like for Re: Working with single quotes and double quotes. 01-28-2021 03:49 PM
- Got a Like for Re: Merge duplicate records in SAS. 08-31-2020 03:27 AM
- Got a Like for Re: Difference between INFILE AND IMPORT. 06-06-2019 12:12 AM
- Got a Like for Re: Difference between INFILE AND IMPORT. 02-07-2019 09:38 PM
- Got a Like for Re: Difference between INFILE AND IMPORT. 08-30-2017 04:42 PM
- Got a Like for Re: Difference between INFILE AND IMPORT. 08-21-2017 03:40 PM
- Got a Like for Re: How do i split my dataset into 70% training , 30% testing ?. 08-15-2017 09:22 AM
- Got a Like for Re: How do i split my dataset into 70% training , 30% testing ?. 06-28-2017 12:06 PM
- Got a Like for Re: Difference between INFILE AND IMPORT. 02-28-2016 12:38 PM
- Got a Like for Re: Difference between INFILE AND IMPORT. 12-04-2015 10:24 AM
- Got a Like for Re: Create a new character variable!. 11-13-2015 09:34 PM
- Got a Like for Re: UPDATE. 09-01-2015 04:24 AM
- Got a Like for Re: change variable type when concatenate multiple data sets?. 09-01-2015 04:24 AM
- Got a Like for Re: change variable type when concatenate multiple data sets?. 09-01-2015 04:24 AM
-
My Liked Posts
Subject Likes Posted 1 09-05-2013 02:03 AM 1 10-18-2012 02:26 AM 1 05-12-2014 03:37 AM 6 10-09-2013 06:20 AM 1 03-17-2014 02:17 AM
09-14-2014
08:41 AM
|| is the concatenation operator in SAS. In Excel you would use &. Call execute(<code to be executed>) allows SAS to place a section of code into the program flow to be executed immediately after the data step concludes. In this case the code to be executed is a macro rept which is intended to draw a vbar chart on var1 for a given date drawing data from the reptdata table. The data _null_ step is intended to provide the date parameter from a table called dates. Lets say the date, being numeric, has the unformatted value 12345 (I have no idea what date that is). Then the code inserted into the program flow should be %rept(12345,var1,reptdata) To get this result the data _null_ step has to join some constant text values: %rept( and then later ,var1,reptdata) with the date value 12345 taken from the dates table in the middle. The expression could be simplified as call execute('%rept(' ||date|| ', var1, reptdata)'); /* spaces added for clarity */ since apparently for this example var1 from reptdata is always used when table dates is used as the source of date data. Richard
... View more
09-12-2014
09:30 AM
As an afterthought: Not every SAS admin can be a Jaap of all trades. Richard
... View more
09-12-2014
09:27 AM
4 Likes
In your example 2.333......333 is the unformatted (underlying) value in Excel, which is what SAS reads and imports. You can apply a SAS format such as 16.1 or comma20.1 after the import to achieve what you want. The standard import procedure in SAS does not carry across the format applied in Excel, although in the case of dates SAS uses the Excel format to identify the value as a date, import it and adjust the base date and apply a SAS date format which might or might not look similar to the Excel format. You might be able to achieve what you want by exporting the data as a text file (CSV or tab delimited) and importing that into SAS. Richard
... View more
09-12-2014
09:01 AM
Cold windy and wet down here but at least I can see where I am heading as I stumble off to work. As it happens I am working for an organisation which is implementing a SAS solution and there seems to be no shortage of opportunities to ply my trade. No doubt that as the products mature over time some of the 'features' will be smoothed over but the SAS admins have quite enough to do, thank you, without having to get involved in model validation, to take an example. I have also recently worked in an organisation which has decided on an in house approach to the same type of development. I think the potential value of the package approach lies in the nature between the organisation and the vendor: it can and should be much more of a partnership than a transaction. My analogy is the doctor and the pharmacist: my doctor understands (some of) what makes me tick, the pharmacist knows my name because it is on the scrip. SAS can sell you the 'pills' for you to use as you see fit, or they can help diagnose and address the business requirements. And when it is all implemented inevitably people move on, diluting the intellectual capital of the organisation, but some of that is offset by having a business partner that continues to understand both the issues and the solution. Richard "too soon to bring out the budgie smugglers"
... View more
09-10-2014
07:35 AM
5 Likes
Well Charlotte If every bank in the world was running identical banking applications on identical machines using identical identifiers and marketing identical products to identical customers using identical business rules in identical regulatory requirements and having identical maverick board members asking identical maverick questions about risk you might have a case that an out of the box credit risk solution could be implemented by a couple of admin, at least until the world suffers its next identical financial crisis and all the rules change again. In the real world sleepless tossing is not advised. In any case you can switch to marketing or fraud detection where it is the nature of success to innovate or at least attempt to keep up with what others are doing, requiring inventiveness and flair which will not come ot of a box. Richard
... View more
09-07-2014
03:20 AM
Wot??? The formula is entirely numeric, intended to operate on a numeric variable, as described by the OP. As it happens I am in agreement with you about automatic conversions. Apology accepted Richard
... View more
09-05-2014
07:21 PM
How are you going to do the merge? You need some common variable in each table to join on to avoid a cartesian product in SQL. If there is none a datastep merge without a by variable might work for you though the result may not be quite what you expect. Step 1: set up a macro to do the merge - here assuming no common variable %macro merge_ctry (ctry, crncy) ; data &ctry._combined ; merge ctry_&ctry crncy_&crncy ; run ; %mend ; Step 2: use a datastep to execute the macro for each ctry - crncy pair data _Null_ ; set countries ; if exist(ctry) and exist(crncy) ; exec_macro = cats('%merge_ctry(', ctry, ', ', crncy, ');') ; /* single quotes essential */ call execute (exec_macro) ; run ; NB the macro invocations will be streamed to execute after the data step terminates. Obviously this is untested but it is a viable approach. Richard
... View more
09-05-2014
06:58 PM
Here is a solution that avoids number to character conversion and back again, and also deals with fractional and negative values int(abs(num)/10**(log10(abs(num))-3)) It works by dividing the number by the requisite power of 10 (including negative power) and truncating the decimal portion. Richard
... View more
08-26-2014
08:50 AM
4 Likes
Here is a solution which will write the original 'code' and its expansion to the log. It can be adapted to write to a file. Fortuitously it deals with the miscode spotted by Data _Null_. Next step named in honour. Data _null_ ; input codes $char60. ; length code base range result $8 ; codes = compress(codes, "'") ; Do k = 1 to 99 ; code = scan (codes, k, ', ') ; if missing(code) then return ; range = scan (code, 2, '.') ; base = scan (code, 1, '.') ; m = input (scan (base, 1, 'C-'), 2.) ; n = input (scan (base, 2, 'C-'), 2.) ; p = input (scan (range, 1, '-'), 1.) ; q = input (scan (range, 2, '-'), 1.) ; if missing (range) then do ; p = 0 ; q = 9 ; end ; put code '> ' ; do j = m to max (m, n) ; base = cat ('C', put (j, z2.)) ; do i = p to max (p, q) ; result = catx ('.', base, i) ; put result @ ; end ; end ; put ; end ; drop codes i j k m n p q base range ; Datalines ; 'C00.3-5, C02-04, C05.0, C05.8-9, C06' 'C01, C10.0, C10.2-3, C10.8-9, C11-12' 'C01, C05.1-2, C09, C10.0, C10.2-3, C10.8-9, C11-14' 'C44.0-4, C47.0, C49.0, C00-14, C30-32, C73' 'C44.5, C44.8-9, C47.6-9, C49.6-9' 'C00-C26, C32-C69, C73, C75.4-9, C76-C80' 'C00-50, C60-61, C63-69, C73-74, C76-80' 'C00, C03-08, C15-17, C19-41, C44-76' 'C00, C03-08, C15-17, C19-41, C44-76' run ; Richard
... View more
08-24-2014
10:56 AM
3 Likes
Assuming you have the date as a macro variable you could create %sysfunc(mod(%sysfunc(month(&Date)), 2)) for a 0 , 1 even - odd or %eval(2 - [the expression above]) to have 1, 2 with 1 odd , 2 even Richard
... View more
08-14-2014
08:56 AM
If you don't have Proc REG you either do not have the SAS STAT product installed or it is damaged. You need SAS STAT to do multivariate analyses. In Base SAS you are limited to univariate analyses and correlations. Richard
... View more
08-14-2014
08:38 AM
Linus' reply is a bit terse. The intnx function will provide an answer, provided you supply the right question. Do you want 9 calendar months exactly (ie to the same day - if possible - 9 months previously), or do you just need the month and the first day will do; or maybe push all dates back by the same amount (0.75 year = 274 days)? Taking these options in reverse order: Prev_date = date - 274 ; Prev_date = intnx("MONTH", date, -9) ; Prev_date = intnx("MONTH", date, -9, "SAME") ; INTNX is documented here SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition BTW, if your dates are datetime intervals you need to use "DTMONTH" instead of "MONTH" ; and for the 274 day calculations use Prev_date = intnx("DTDAY", date, -274, "SAME") ; Richard
... View more
08-01-2014
06:43 AM
Try running your code but including the missing statement after the data statement. "missing" is a global statement that notifies SAS that your code handles special missing values. Richard
... View more
07-30-2014
08:13 AM
Microsoft DDE only works when both the application issuing the DDE statements and the target application are on the same Windows platform. Typically, when using SAS EG, the core SAS application resides on a server (which may or may not be a Windows server) but the Excel instance is on a local machine. SAS EG, even though it is located locally, is not itself involved in DDE; it merely issues SAS code to the server to be executed. Use EG file import/export to move data between Excel and SAS. Despite its many merits, (and many champions), DDE is legacy technology which, as you have found, is not scalable in a client server (EG) situation. Microsoft and others did toy with the idea of making it more generic but it didn't happen and we now have to find repoacement methods. I have some sympathy for you if you have been given some code to run. You can only make DDE work if you have Base SAS (and Excel) installed on your desktop, or you can adapt the code to work on a Windows server where you have SAS. If your workplace can provide that, good. Otherwise you have been set a task you cannot complete. Richard.
... View more