turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Need help with %syscall compcost

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-24-2014 04:57 AM

Hi,

Does anyone have an example of the correct way to enter the syntax for '%syscall compcost'? Having a real hard time trying to find an example of this on the web!

I've gone down the path of trial and error, and I've found that the following syntax at least doesn't trigger an error:

%let a = insert;

%let b = 1;

%syscall compcost(a,b);

However, the changes don't seem to be taking effect when I perform a COMPGED function.

I know how to use compcost within a data step, but for the work I'm doing at the moment it will be more practical to modify the COMPGED values on the global scale using %syscall compcost. Can anyone help?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-24-2014 06:31 AM

This implies "to me" that it does work.

%local a b s;

%let s = xballoon;

%let a = insert;

%do b =

%syscall compcost(a,b);

%let ged=%sysfunc(compged(&s,balloon));

%put &=ged &=b;

%end;

%

GED=

GED=

GED=

GED=

GED=

GED=

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-24-2014 06:50 AM

Oh ok... so thats working within a macro statement. Maybe my problem is that I'm trying to use this function in open code. I'll package what I'm doing into a macro instead and see how that goes. Cheers for the advice!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-24-2014 06:58 AM

I used the macro to loop the value B but this open code appears to work. What version of SAS are you using?

%let s = xballoon;

%let a = insert;

%let b = 5000;

%syscall compcost(a,b);

%let ged=%sysfunc(compged(&s,balloon));

%put &=ged &=b;

35 %let s = xballoon;

36 %let a = insert;

37 %let b = 5000;

38 %syscall compcost(a,b);

39 %let ged=%sysfunc(compged(&s,balloon));

40 %put &=ged &=b;

GED=**5000** B=**5000**

%let a = insert;

%let b = 5000;

%syscall compcost(a,b);

%let ged=%sysfunc(compged(&s,balloon));

%put &=ged &=b;

35 %let s = xballoon;

36 %let a = insert;

37 %let b = 5000;

38 %syscall compcost(a,b);

39 %let ged=%sysfunc(compged(&s,balloon));

40 %put &=ged &=b;

GED=

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-24-2014 09:59 AM

Version 9.3, I think...

What happens with the following bit of code? I'd give it a go myself but I can't access from home lol

%let a = insert;

%let b = 5000;

%syscall compcost(a,b);

data ged_test;

str1 = 'balloon';

str2 = 'xballoon';

ged = compged(str1, str2);

run;

Is the value of variable 'ged' in the resulting dataset still 5000?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-24-2014 11:10 AM

No it appears the SYSCALLed COMPCOST only works for %SYSFUNCed COMPGED. See slightly modified example. If you un-comment the CALL COMPCOST in the data step you can execute COMCOST with values of &A and &B;

%let a = insert;

%let b = 5000;

%syscall compcost(a,b);

**data** _null_;

*if _n_ eq 1 then call compcost("&a=",&b);

str1 = 'balloon ';

str2 = 'xballoon';

ged = compged(str2, str1); *modified you had str1 first.;

put ged=;

ged2 = compged(str1, str2); *yours;

put ged2=;

**run**;

%put NOTE: %sysfunc(compged(xballoon,balloon));

%put NOTE: %sysfunc(compged(balloon,xballoon));

%let b = 5000;

%syscall compcost(a,b);

*if _n_ eq 1 then call compcost("&a=",&b);

str1 = 'balloon ';

str2 = 'xballoon';

ged = compged(str2, str1); *modified you had str1 first.;

put ged=;

ged2 = compged(str1, str2); *yours;

put ged2=;

%put NOTE: %sysfunc(compged(xballoon,balloon));

%put NOTE: %sysfunc(compged(balloon,xballoon));