JMP vs. SAS<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />I am a long-time SAS user who uses macro variables to act as placeholders for strings repeatedly used in a program such as path, filename, array columns, etc.
Does JSL have similar functionality?
A couple examples would be greatly appreciated.
Re: JMP vs. SASAlso. be aware that you can put blocks of code into expressions (which could be put into external files and 'included' if need be). Then you can use 'Substitute()':
Names Default To Here( 1 );
codeBlock = Expr(Print("Macro Variable is "||Char(a%)));
Eval(Substitute( NameExpr(codeBlock), Expr(a%), 10 ));
Eval(Substitute( NameExpr(codeBlock), Expr(a%), 20 ));
Re: JMP vs. SASHere is a simpler example that more directly addresses the idea of a placeholder for strings. So no direct equivalent of SAS macro variables, but you can accomplish the same thing with JSL variables doing your own concatenation using the "||" concatenation operator ("+" is not used to concatenate strings in JMP):
path = "c:\users\public\temp\";
dt1 = Open( path || "bc_mcv.jmp" );
dt2 = Open( path || "airports_by_state.jmp" );
Hope this helps.
Eric
Re: JMP vs. SASThanks, Ian. That pointed me in the right direction.
I am using JMP and SAS in complementary fashion.
Re: JMP vs. SASThe SAS language and JSL are very different in syntax, structure and intent (reflecting the very different nature of the SAS System and JMP).
Probably the closest parallel would be the ability to define functions in JSL, with the arguments being passed being analogous to the values of macro variables. An example might be:
NamesDefaultToHere(1);
// Given a table and a column therein, makes a Distribution and returns a reference to
// the resulting object
doDistribution =
Function({inTable, inCol}, {Default Local},
thisDistribution = inTable << Distribution(Column(inCol))
);
// Open a table
dt = Open("$SAMPLE_DATA/Big Class.jmp");
// Make a distribution and close it
myDistribution = doDistribution(dt, Column(dt, "height"));
Wait(3);
Report(myDistribution) << closeWindow;
Wait(3);
// Make two distributions and close them in the reverse order
dist1 = doDistribution(dt, Column(dt, "weight"));
Wait(3);
dist2 = doDistribution(dt, Column(dt, "height"));
Wait(3);
Report(dist2) << closeWindow;
Wait(3);
Report(dist1) << closeWindow;
Given the title of the thread, I feel obligated to also mention that there is no sense in which SAS and JMP are in opposition. Indeed, JMP and SAS interoperate very well, when the use case to hand demands it.