This is just a hunch, but it looks like the $-sign that appears after a back-slash '\' is treated literally as a string $ and not as a $-sign expansion. Questions to consider:
1. Do you need 2 forward-slash characters? I think you should be fine with this:
$(vDataDir)$(d) , considering that the variable vDataDir is ending with a forward slash.
2. Perhaps you could build the whole path and file name as a single variable before the load and therefore eliminate any possibility of a confusion.
it seems correct debugging it but fhe files created are uncorrect.
Why the extension is .qvf.
Why the name is $(d).
I do not understand. The folder contains files users.qvf and $(d) .qvd .
//STORE TABLES AS QVD
SET vDataDir = 'lib://qvd data/';
for i=0 to NoOfTables()-1
LET d= TableName(i);
STORE $(d) into $(vDataDir)$(d).qvd;
LET j = NoOfTables();
do while j > 0
let d = TableName(0);
drop table $(d);
let j = NoOfTables();