-
Notifications
You must be signed in to change notification settings - Fork 0
/
me-margin-calculation.sas
1987 lines (1732 loc) · 119 KB
/
me-margin-calculation.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***************************************************************************/
/* ANTIDUMPING MARKET ECONOMY */
/* MARGIN CALCULATION PROGRAM */
/* */
/* GENERIC VERSION LAST UPDATED AUGUST 13, 2024 */
/* */
/* Part 1: Database and General Program Information */
/* Part 2: Bring In U.S. Sales, Convert Date Variable, If Necessary, */
/* Merge Exchange Rates into Sales, If Required */
/* Part 3: Cost Information */
/* Part 4: Calculate the Net U.S. Price */
/* Part 5: Convert Comparison Market Net Prices and Adjustments into CM */
/* Currency, If Required */
/* Part 6: Create Concordance of Price-To-Price Matching Instructions */
/* Part 7: Level of Trade Adjustment, If Required */
/* Part 8: Combine U.S. Sales with CM Matches, Calculate Transaction- */
/* Specific Lot Adjustments, CEP and Commission Offsets */
/* Part 9: Calculate CEP and Commission Offsets For Constructed Value */
/* Comparisons */
/* Part 10: Combine Price-2-Price Comparisons with Sales Compared To CV */
/* Part 11: Cohen's-d Test */
/* Part 12: Weight Average U.S. Sales */
/* Part 13: Calculate FUPDOL, NV, PUDD, Etc. Using the Standard Method, */
/* the A-to-T Alternative Method and, When Required, the Mixed */
/* Alternative Method */
/* Part 14: Cash Deposit Rates */
/* Part 15: Meaningful Difference Test */
/* Part 16: Assessment Rates (Administrative Reviews Only) */
/* Part 17: Reprint the Final Cash Deposit Rate */
/* Part 18: Delete All Work Files in the SAS Memory Buffer, If Desired */
/* Part 19: Calculate Run Time for This Program, If Desired */
/* Part 20: Review Log for Errors, Warnings, Uninit. etc. */
/***************************************************************************/
/*-----------------------------------------------------------------------*/
/* EDITING THE PROGRAM: */
/* */
/* Places requiring edits are indicated by angle brackets (i.e., '< >'). */
/* Replace angle brackets with case-specific information. */
/* */
/* Types of Inputs: (D) = SAS dataset name */
/* (V) = Variable name */
/* (T) = Text (no specific format), */
/* do NOT use punctuation marks */
/* */
/* If there are angle brackets that are commented out, replacing the */
/* angles brackets with case specific code is optional. For example: */
/* */
/* <Insert changes here, if required.> */
/*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------*/
/* EXECUTING/RUNNING THE PROGRAM: */
/* */
/* In addition to executing the entire program, you can do */
/* partial runs. Executable points from which you can */
/* partially run the program are indicated by '/*ep*' on */
/* the left margin. To do a partial run, just highlight the */
/* program from one of the executable points to the top, */
/* then submit it. */
/*-------------------------------------------------------------------------*/
/***************************************************************************/
/* PART 1: DATABASE AND GENERAL PROGRAM INFORMATION */
/***************************************************************************/
/*-------------------------------------------------------------------------*/
/* 1-A: LOCATION OF DATA AND MACROS PROGRAM */
/* */
/* LIBNAME = The name (i.e., COMPANY) and location of the */
/* sub-directory containing the SAS datasets for */
/* this program. */
/* EXAMPLE: E:\Operations\Fiji\AR_2016\Hangers\Acme */
/* */
/* FILENAME = Full path of the Macro Program for this case, */
/* consisting of the sub-directory containing the */
/* Macro Program and its file name. */
/*-------------------------------------------------------------------------*/
LIBNAME COMPANY '<E:\....>'; /* (T) Location of company and */
/* exchange rate data sets. */
FILENAME MACR '<E:\...\ME Macros.sas>'; /* (T) Location & name of AD-ME */
/* All Macros Program. */
%INCLUDE MACR; /* Use the AD-ME All Macros */
/* Program. */
FILENAME C_MACS '<E:\...\Common Macros.sas>'; /* (T) Location & Name of the */
/* Common Macros Program */
%INCLUDE C_MACS; /* Use the Common Macros */
/* Program. */
%LET LOG_SUMMARY = YES; /* Default value is "YES" (no */
/* quotes). Use "NO" (no */
/* quotes) to run program in */
/* parts for troubleshooting. */
/*-----------------------------------------------------------------------------*/
/* WRITE LOG TO THE PROGRAM DIRECTORY - DO NOT MOVE/CHANGE THIS SECTION */
/*-----------------------------------------------------------------------------*/
%GLOBAL MNAME LOG;
%LET MNAME = %SYSFUNC(SCAN(%SYSFUNC(PATHNAME(C_MACS)), 1, '.'));
%LET LOG = %SYSFUNC(SUBSTR(&MNAME, 1, %SYSFUNC(LENGTH(&MNAME)) - %SYSFUNC(INDEXC(%SYSFUNC(
REVERSE(%SYSFUNC(TRIM(&MNAME)))), '\'))))%STR(\)%SYSFUNC(DEQUOTE(&_CLIENTTASKLABEL.))%STR(.LOG);
%CMAC1_WRITE_LOG;
/*------------------------------------------------------------------*/
/* 1-B: PROCEEDING TYPE */
/*------------------------------------------------------------------*/
/*-----------------------------------------------*/
/* TYPE IN EITHER THE WORD 'AR' (NOT 1ST REVIEW) */
/* OR THE WORD 'INV'. DO NOT TYPE THE QUOTES. */
/*-----------------------------------------------*/
%LET CASE_TYPE = <AR/INV>; /*(T) For an investigation, type 'INV' */
/* (without quotes) */
/* For an administrative review, */
/* type 'AR' (without quotes) */
/*------------------------------------------*/
/* TYPE IN THE CASE NUMBER (EX. A-357-812). */
/*------------------------------------------*/
%LET CASE_NUMBER = < >; /*(T) Case Number */
/*-------------------------*/
/* TYPE IN YOUR FULL NAME. */
/*-------------------------*/
%LET PROGRAMMER = < >; /*(T) Case Analyst responsible for programming */
/*--------------------------------------------------------------------*/
/* 1-C: DATE INFORMATION */
/* */
/* Dates should be written in SAS DATE9 format (e.g., 01JAN2020). */
/* */
/* USSALEDATE: */
/* */
/* The date of sale variable defined by the macro variable */
/* USSALEDATE will be used to capture all U.S. sales within the date */
/* range specified by the macro variables USBEGINDAY and USENDAY. */
/* */
/* USDATEBEFORESALE and USEARLIERDATE: */
/* */
/* If there are reported dates before the sale date and you want */
/* the earlier dates to be assigned to sale date, define the macro */
/* variable USDATEBEFORESALE to 'YES' and assign the variable with */
/* earlier dates to the macro variable USEARLIERDATE (ex. SHIPDATU). */
/* Otherwise define the macro variable USDATEBEFORESALE to 'NO' and */
/* ignore the macro variable USEARLIERDATE. */
/* */
/* USBEGINDAY and USENDDAY: */
/* */
/* Define the macro variables USBEGINDAY and USENDDAY to correspond */
/* to the universe of U.S. sales that you want to use. */
/* */
/* For Investigations USBEGINDAY often corresponds to the first day */
/* of the first month of the POR and USENDDAY often corresponds to */
/* the last day of the last month of the POR, respectively, */
/* covering all U.S. sales dates. */
/* */
/* For Reviews USBEGINDAY often corresponds to the first day of the */
/* first month of the POR and USENDDAY often corresponds to the last */
/* day of the last month of the POR, respectively, covering, all U.S. */
/* sales dates. Reported CEP sales usually include all sales during */
/* the POR. For EP sales, they usually include all entries during */
/* the POR. Accordingly, there may be U.S. sales transactions with */
/* sale dates prior to the POR. In these cases, adjust USBEGINDAY to */
/* to correspond to the first day of the month of the earliest sale */
/* you want to keep. */
/* */
/* HMBEGINWINDOW: */
/* */
/* The macro variable HMBEGINWINDOW refers to the beginning of the */
/* window period in an Administrative Review. It is used to define */
/* the variable USMONTH that represents the month and year of the */
/* sale. It is not required for Investigations. */
/* */
/* QUARTERLY COMPARISONS: When making quarterly price-to-price */
/* comparisons of CM and U.S. sales, comparisons are not made outside */
/* of designated time periods. In such cases, set HMBEGINWINDOW to */
/* the first day of the first time period. */
/* */
/* Note: In a review the Margin Calculation macro variable */
/* HMBEGINWINDOW needs to have the same value as the ME Comparison */
/* Market Program macro variable HMBEGINDAY so that model matching */
/* will work properly. */
/*--------------------------------------------------------------------*/
%LET USSALEDATE = < >; /* (V) Variable representing the */
/* U.S. sale date. */
%LET USDATEBEFORESALE = <YES/NO>; /* (T) Adjust sale date based on */
/* an earlier date variable? */
/* Type 'YES' (no quotes) to */
/* adjust the sale date, or */
/* 'NO' to skip this part. */
/* If you typed 'YES' then */
/* also complete the macro */
/* variable USEARLIERDATE. */
%LET USEARLIERDATE = < >; /* (V) Variable representing the */
/* earlier date variable. */
%LET USBEGINDAY = <DDMONYYYY>; /* (T) Please see above 1-C: DATE */
/* INFORMATION for guidance. */
%LET USENDDAY = <DDMONYYYY>; /* (T) Please see above 1-C: DATE */
/* INFORMATION for guidance. */
/* Note: In a review the Margin Calculation macro variable */
/* HMBEGINWINDOW needs to have the same value as the CM macro variable */
/* variable HMBEGINDAY so that model matching will work properly. */
%LET HMBEGINWINDOW = <DDMONYYYY>; /* (T) Please see above 1-C: DATE */
/* INFORMATION for guidance. */
/* NOT required for */
/* investigations. */
/*--------------------------------------------------------------*/
/* 1-C-ii: ADDITIONAL FILTERING OF U.S. SALES, IF REQUIRED */
/* */
/* Should you additionally wish to filter U.S. sales using */
/* different dates and/or date variables for CEP v EP sales, */
/* complete the following section. This may be useful when */
/* you have both EP and CEP sales in an administrative review. */
/* In reviews, reported CEP sales usually include all sales */
/* during the POR. For EP sales in reviews, reported sales */
/* usually include all entries during the POR. To filter EP */
/* sales by entry date, for example, you would put the first */
/* and last days of the POR for BEGINDAY_EP and ENDDAY_EP, and */
/* the variable for date of entry under EP_DATE_VAR. */
/*--------------------------------------------------------------*/
%LET FILTER_CEP = <YES/NO>; /*(T) Additionally filter CEP sales? */
/* Type "YES" (no quotes) to */
/* filter, "NO" to skip this part. */
/* If you typed "YES," then also */
/* complete the three subsequent */
/* indented macro variables. */
%LET CEP_DATE_VAR = < >; /*(V) The date variable to be used to */
/* filter CEP sales */
%LET BEGINDAY_CEP = <DDMONYYYY>; /*(T) Day 1 of 1st month of CEP U.S. */
/* sales to be kept. */
%LET ENDDAY_CEP = <DDMONYYYY>; /*(T) Last day of last month of CEP */
/* U.S. sales to be kept. */
%LET FILTER_EP = <YES/NO>; /*(T) Additionally filter EP sales? */
/* Type "YES" (no quotes) to */
/* filter, "NO" to skip this part. */
/* If you typed "YES," then also */
/* complete the three subsequent */
/* indented macro variables. */
%LET EP_DATE_VAR = < >; /*(V) The date variable to be used to */
/* filter EP sales, such as, */
/* entry date. */
%LET BEGINDAY_EP = <DDMONYYYY>; /*(T) Day 1 of 1st month of EP U.S. */
/* sales to be kept. */
%LET ENDDAY_EP = <DDMONYYYY>; /*(T) Last day of last month of EP */
/* U.S. sales to be kept. */
/*-------------------------------------------------------------------------*/
/* 1-D: TITLES, FOOTNOTES AND AUTOMATIC NAMES FOR OUTPUT DATASETS */
/* */
/* The information below will be used in creating titles, footnotes */
/* and the names of output datasets for later use in the U.S. Sales */
/* Margin Program. */
/* */
/* NAMES FOR OUTPUT DATASETS: */
/* */
/* Names of all output datasets generated by this program will have a */
/* standardized prefix using the format: "RESPONDENT_SEGMENT_STAGE" */
/* in which: */
/* */
/* RESPONDENT = Respondent identifier (e.g., company name) */
/* SEGMENT = Segment of proceeding (e.g., INVEST, AR6, REMAND) */
/* STAGE = PRELIM or FINAL */
/* */
/* The total number of places/digits used in the RESPONDENT, SEGMENT */
/* and STAGE identifiers, combined, should NOT exceed 21. Letters, */
/* numbers and underscores are acceptable. No punctuation marks, */
/* blank spaces or special characters should be used. */
/* */
/* The names of the output datasets this program creates, where */
/* applicable, are the following: */
/* */
/* {RESPONDENT_SEGMENT_STAGE}_COST = Wt-avg costs */
/* {RESPONDENT_SEGMENT_STAGE}_HMCEP = CM revenue/expenses for */
/* CEP profit */
/* {RESPONDENT_SEGMENT_STAGE}_CVSELL = Selling & profit ratios */
/* for CV */
/* {RESPONDENT_SEGMENT_STAGE}_HMWTAV = Wt-avg CM data */
/* {RESPONDENT_SEGMENT_STAGE}_LOTADJ = LOT adjustment factors */
/* */
/* All output datasets will be placed in the COMPANY directory. */
/*-------------------------------------------------------------------------*/
%LET PRODUCT = %NRBQUOTE(<Product under Investigation or Review>); /*(T) Product */
%LET COUNTRY = %NRBQUOTE(<Country under Investigation or Review>); /*(T) Country */
/*-------------------------------------------------------------------------*/
/* The macro variables BEGINPERIOD and ENDPERIOD refer to the beginning */
/* and at the end of the official POI/POR. They are used for titling. */
/* BEGINPERIOD is also used in the Cohen’s d Test. */
/* */
/* Typically, these dates refer to the first day of the first month for */
/* the POI/POR for the BEGINPERIOD and the last day of the last month of */
/* the POI/POR for the ENDPERIOD. However, for first administrative */
/* reviews BEGINPERIOD is dependent on the injury results of the */
/* International Trade Commission (ITC) and the first day of suspension of */
/* liquidation. Please confirm the BEGINPERIOD with the Federal Register */
/* Notice initiating the first administrative review. */
/*-------------------------------------------------------------------------*/
%LET BEGINPERIOD = <DDMONYYYY>; /* (T) First day of the official POI/POR. */
%LET ENDPERIOD = <DDMONYYYY>; /* (T) Last day of the official POI/POR. */
/*------------------------------------------------------------------------*/
/* Between the RESPONDENT, SEGMENT and STAGE macro variables below, there */
/* should be a maximum of 21 digits. */
/*------------------------------------------------------------------------*/
%LET RESPONDENT = < >; /*(T) Respondent identifier. Use only letters, numbers */
/* and underscores. No punctuation marks, blank */
/* spaces or special characters should be used. */
%LET SEGMENT = < >; /*(T) Segment of the proceeding, e.g., Invest, AR1, */
/* Remand. Use only letters, numbers and underscores */
/* No punctuation marks, blank spaces or special */
/* characters should be used. */
%LET STAGE = < >; /*(T) Stage of proceeding, e.g., Prelim, Final, Remand. */
/* Use only letters, numbers and underscores. No */
/* punctuation marks, blank spaces or special */
/* characters should be used. */
/*-------------------------------------------------------------------*/
/* 1-E: DATABASE INFORMATION FOR U.S. AND CM SALES, COSTS AND */
/* EXCHANGE RATES */
/* */
/* Where information may not be relevant (e.g., re: manufacturer */
/* and prime/non-prime merchandise), 'NA' (not applicable) will */
/* appear as the default value. */
/*-------------------------------------------------------------------*/
/*--------------------------------------------------------------*/
/* 1-E-i. EXCHANGE RATE INFORMATION: */
/* */
/* If, for example, you are using Mexican pesos, type */
/* %LET EXDATA1 = MEXICO immediately following. Then, */
/* in your programming later on, you would use any of */
/* the following methods to refer that exchange rate: */
/* */
/* EXRATE_MEXICO or */
/* &EXRATE1 or */
/* EXRATE_&EXDATA1 */
/* */
/* Use EXDATA1 for the CM currency, when required. */
/* It is &EXRATE1 that is used to convert costs and */
/* the CM net price into U.S. dollars. */
/* */
/* If your Comparison Market is reported in more than */
/* onecurrency, you must update section 9-B-i in the */
/* CM program, as well as sections 1-E-i, 1-E-v, and */
/* Part 5 of the Margin program. Instructions for */
/* filling out those sections are contained at the */
/* beginning of each relevant section. */
/* */
/* In the event either exchange rate is not required, */
/* dummy variables with neutral values are created. */
/* (See section 4-A below.) */
/*--------------------------------------------------------------*/
%LET USE_EXRATES1 = <YES/NO>; /*(T) Use exchange rate #1? Type "YES" or */
/* "NO" (without quotes). */
%LET EXDATA1 = < >; /*(D) Exchange rate dataset name. Use the */
/* currency Cost data is reported in. */
%LET USE_EXRATES2 = <YES/NO>; /*(T) Use exchange rate #2? Type "YES" or */
/* "NO" (without quotes). */
%LET EXDATA2 = < >; /*(D) Exchange rate dataset name. */
/*--------------------------------------------------------------*/
/* 1-E-ii. U.S. SALES INFORMATION */
/*--------------------------------------------------------------*/
%LET USDATA = < >; /*(D) U.S. sales dataset filename. */
%LET USBARCODE = < >; /*(T) Bar code number(s) of U.S. dataset(s) */
/* used in this program. */
%LET USCONNUM = < >; /*(V) Control number */
%LET USCVPROD = < >; /*(V) Variable (usually CONNUMU) linking */
/* sales to cost data. */
/* Note: For model matching to work, physical characteristic variables */
/* need to be defined as all character or all numeric. Physical */
/* characteristic variable values need to be all numeric. */
%LET USCHAR = < >; /*(V) Product matching characteristics. List */
/* them from left to right importance, */
/* with no punctuation separating them. */
/* Do not surrounded the values with */
/* quotes. */
%LET SALETYPE = < >; /*(V/T) Variable indicating type of U.S. sales*/
/* (EP vs. CEP), if any. If there is no */
/* variable and U.S. sales are all */
/* of one type, then type either EP or */
/* CEP (without quotes) to indicates */
/* which type. */
%LET USQTY = < >; /*(V) Quantity */
%LET USGUP = < >; /*(V) Gross price. Need not be in consistent */
/* currency, used only to check for zero, */
/* negative and missing values. */
%LET USLOT = <NA>; /*(V) Level of trade. If not reported in the */
/* database and not required, type "NA" */
/* (without quotes). You may also type */
/* "NA" if CM & US both have only 1 LOT */
/* and those LOTs are the same. */
/* Note: Specify a U.S. manufacturer variable if there is also a */
/* manufacturer variable reported in the CM sales or in straight */
/* to CV situation with manufacturer reported in the Cost data. */
%LET USMANUF = <NA>; /*(V) Manufacturer code. If not applicable, */
/* type "NA" (without quotes). */
/* Note: Specify a U.S. prime variable if there is also a prime variable */
/* reported in the CM sales or in straight to CV situation with */
/* prime reported in the Cost data. */
%LET USPRIME = <NA>; /*(V) Prime/seconds code. If not applicable, */
/* type "NA" (without quotes). */
%LET ENTERVAL = <NA>; /*(V) Variable for reported entered value. If */
/* there is no variable, type "NA" (without*/
/* quotes.) */
%LET IMPORTER = <IMPORTER/CUSCODU>; /* (V) Type in 'IMPORTER' or */
/* 'CUSCODU'. Do not type the quotes. */
%LET EX1_VARS = <NA>; /*(V) Variables in EXDATA1 currency to be */
/* converted into U.S. dollars, including */
/* packing. If not applicable, type "NA" */
/* (without quotes). The converted */
/* variables in U.S. dollars will have the */
/* names of the old ones with the suffix */
/* '_USD' added. */
%LET EX2_VARS = <NA>; /*(V) Variables in EXDATA2 currency to be */
/* converted into U.S. dollars, including */
/* packing. If not applicable, type "NA" */
/* (without quotes). The converted */
/* variables in U.S. dollars will have the */
/* names of the old ones with the suffix */
/* '_USD' added. */
/*-----------------------------------------------------------------*/
/* 1-E-ii-b. COHEN'S-D TEST */
/* */
/* Normally, the regions will correspond to the 5 Census */
/* regions: Northeast, Midwest, South, West, and Puerto Rico. */
/* (Do not include U.S. Territories other than Puerto Rico */
/* because they are not in the Customs Territory of the U.S.) */
/* */
/* If you have a region variable, type DP_REGION_DATA=REGION */
/* and then specify the region variable in DP_REGION=???. */
/* Please note that any unknown regions should be listed as */
/* blank spaces and not, for example, as "UNKNOWN" or "UNK." */
/* */
/* If you instead have a variable that has either the 2-digit */
/* postal state code or the zip code (5 or 9 digits), then */
/* indicate the same below by typing DP_REGION_DATA=STATE or */
/* DP_REGION_DATA=ZIP. If you need to write your own language */
/* to create the Census regions, do so in Sect. 2-B below */
/* re: changes and edits to the U.S. database. */
/* */
/* If you have any unknown purchasers/customers, they should */
/* be reported as blank spaces and not, for example, as */
/* "UNKNOWN" or "UNK." If this is not the case, please edit */
/* the data accordingly. */
/* */
/* Usually, time periods for purposes of the Cohen's-d Test */
/* will be defined by quarters, beginning with the first month */
/* of POI/POR as found in the BEGINPERIOD macro variable */
/* defined above in Sect.1-B-i. If you wish to use quarters */
/* and do not have a variable for the same, type */
/* DP_TIME_CALC=YES and the program will use the sale date */
/* variable to assign quarters. If you already have a */
/* variable for quarters or are using something other than */
/* quarters, type DP_TIME_CALC=NO and also indicate the */
/* variable containing the time periods in DP_TIME=???. */
/*-----------------------------------------------------------------*/
%LET DP_PURCHASER = < >; /*(V) Variable indicating */
/* customer for purposes of */
/* the DP analysis. */
%LET DP_REGION_DATA = <REGION/STATE/ZIP>; /*(T) Type either "REGION", */
/* "STATE", or "ZIP" (without */
/* quotes) to indicate the */
/* type of data being used */
/* to assign Census regions. */
/* Then complete the */
/* DP_REGION macro */
/* variable immediately */
/* following. */
%LET DP_REGION = < >; /*(V) Variable indicating the */
/* DP region if you typed */
/* "REGION" for */
/* DP_REGION_DATA, or the */
/* variable indicating the */
/* 2-digit postal state */
/* designation if you typed */
/* "STATE," or the variable */
/* indicating the 5-digit zip */
/* code if you typed "ZIP." */
%LET DP_TIME_CALC = <YES/NO>; /*(T) Type "YES" (without */
/* quotes)to assign quarters */
/* using the beginning of */
/* the period. */
%LET DP_TIME = < >; /*(V) If you typed "NO" for */
/* DP_TIME_CALC because you */
/* already have a variable */
/* for the DP time period, */
/* indicate that variable */
/* here. */
/*-----------------------------------------------------------------------*/
/* 1-E-iii. NORMAL VALUE PREFERENCE AND CONSTRUCTED VALUE DATA SELECTION */
/* */
/* Set the macro variable NV_TYPE to "P2P" if at least one CM sale */
/* survives the CM Program. The Margin Program will try to make */
/* Price-to-Price comparisons or all U.S. sales and make */
/* Price-to-CV comparisons for any U.S. sales the program cannot */
/* find a model match for. */
/* */
/* Set the macro variable NV_TYPE to "CV" if no CM sales survive */
/* the CM Program or you want to make Price-to-CV comparison for */
/* all U.S. sales. */
/* */
/* Set the macro variable COST_TYPE to "HM" if at least one CM */
/* sale survives the CM Program. */
/* */
/* Set the macro variable COST_TYPE to "CV" if no CM sales survive */
/* the CM Program or you want to make Price-to-CV comparison for */
/* all U.S. sales. */
/*-----------------------------------------------------------------------*/
%LET NV_TYPE = <P2P/CV>; /*(T) Type "P2P" (without quotes) if you have */
/* CM data for price-to-price comparisons. */
/* Sales not finding a price-to-price */
/* comparison will then be matched to CV. */
/* Type "CV" (without quotes) to compare */
/* U.S. sales directly to CV. */
%LET COST_TYPE = <CM/CV>; /*(T) Type "CM" (without quotes) when */
/* pulling costs from the CM program. */
/* Type "CV" (without quotes) when */
/* calculating CV in this Margin */
/* program. */
/*----------------------------------------------------------------*/
/* 1-E-iv. COMPARISON MARKET INFORMATION */
/* */
/* Complete the next section if you typed NV_TYPE = P2P above */
/* because you have CM sales for Price-2-Price comparisons. */
/* */
/* If information in the CM sales data is in more than one */
/* currency, type CM_MULTI_CUR = YES directly below. You will */
/* then also have to edit Part 5 below to (re)calculate the */
/* CM net price, etc., using currency conversions on the date */
/* of the U.S. sale. */
/*----------------------------------------------------------------*/
/* Note: Specify a CM manufacturer variable if there is also a */
/* manufacturer variable reported in the U.S. sales. */
%LET HMMANUF = <YES/NO>; /*(T) Is there a CM manufacturer variable? */
/* Type "YES" or "NO" (without quotes). */
/* Note: Specify a CM prime variable if there is also a prime */
/* variable reported in the U.S. sales. */
%LET HMPRIME = <YES/NO>; /*(T) Is there a CM prime variable? Type */
/* "YES" or "NO" (without quotes). */
/* Note: For model matching to work, physical characteristic variables */
/* need to be defined as all character or all numeric. Physical */
/* characteristic variable values need to be all numeric. */
%LET HMCHAR = < >; /*(V) Product matching characteristics. */
/* List them from left to right */
/* in order of importance, with no */
/* punctuation separating them. Do not */
/* surround the values with quotes. */
%LET HM_MULTI_CUR = <YES/NO>; /*(T) Is CM data in more than one */
/* currency? Type "YES" or "NO" */
/* (without quotes). If it is "YES", */
/* then you must also fill out sections */
/* 1-E-i and 9-B-i of the CM program, */
/* as well as sections 1-E-i, and */
/* Part 5 of the Margin program. */
/*--------------------------------------------------------------*/
/* 1-E-v. COST DATA MODEL MODIFIERS */
/* */
/* Both macro variables COP_MANUF and COP_PRIME need to be */
/* defined in Price-to-Price and Straight-to-CV situations. */
/*--------------------------------------------------------------*/
%LET COP_MANUF = <YES/NO>; /*(V) Are there manufacturer variables */
/* in both the sales and the cost */
/* datasets? Type "YES" or "NO" */
/* (without quotes). */
%LET COP_PRIME = <YES/NO>; /*(T) Are there prime variables in */
/* both the sales and the cost */
/* datasets? Type "YES" or "NO" */
/* (without quotes). */
/*-----------------------------------------------------------------*/
/* 1-E-vi-a. QUARTERLY CONSTRUCTED VALUE CALCULATIONS */
/* */
/* To restrict sales comparisons and the calculation of costs */
/* to within designated time periods, type "YES" and complete */
/* Section 1-E-vi-a. If, instead, you type "NO", you can skip */
/* can Section 1-E-vi-a. */
/* */
/* If you have sales and cost data coming from the HM program, */
/* those, too, should be calculated on a time-specific */
/* basis when making comparisons to U.S. sales based on time. */
/* */
/* Note: You do not need a separate cost database to restrict */
/* sales comparison to within time periods. However, the VCOMs */
/* and TCOMs in the sales databases should also be calculated */
/* on a time-specific basis. */
/*-----------------------------------------------------------------*/
%LET COMPARE_BY_TIME = <YES/NO>; /*(T) Calculate costs by time */
/* periods? Type "YES" or "NO" */
/* (without quotes). If */
/* "YES," then also complete */
/* Section 1-E-vi-a below. */
/*-------------------------------------------------------------*/
/* 1-E-vi-a. QUARTERLY CONSTRUCTED VALUE CALCULATIONS */
/* */
/* Complete this section if you type all of the following: */
/* */
/* COST_TYPE = CV (1-E-iii) */
/* COMPARE_BY_TIME = YES (immediately above) */
/*-------------------------------------------------------------*/
/* Note: The cost time period variable needs to be defined as a two */
/* digit character variable. The cost time period variable values */
/* need to be all numeric and left justified. */
%LET COST_TIME_PERIOD = < >; /*(V) Variable in cost data */
/* for time periods. */
%LET TIME_INSIDE_POR = < >; /*(T) List of values of */
/* &COST_TIME_PERIOD */
/* variable for periods */
/* during the POR, */
/* separated by commas, and */
/* surrounded by quotes */
/* Values in the variables */
/* must only be numbers, */
/* i.e. '-1', '0', '1', '2', */
/* '3', etc. */
%LET DIRMAT_VARS = < >; /*(V) List the direct materials */
/* variables in the */
/* cost dataset that will */
/* need to be indexed. I.e. */
/* COIL ZINC SCRAPS. List */
/* the variables separately */
/* do not put in quotes or */
/* separate using commas. */
%LET TOTCOM = < >; /*(V) Reported total cost of */
/* manufacturing, often */
/* TOTCOM. */
/*-----------------------------------------------------*/
/* 1-E-vii. HIGH INFLATION COSTS */
/* */
/* If you type COMPARE_BY_HIGH_INFLATION = YES on the */
/* first line also complete the rest of this section. */
/*-----------------------------------------------------*/
%LET COMPARE_BY_HIGH_INFLATION = <YES/NO>; /*(T) Calculate high inflation? */
/* Type "YES" or "NO" */
/* (without quotes). */
%LET COST_YEAR_MONTH = < >; /*(V) Variable in Cost data */
/* representing year and month. */
%LET LAST_YEAR_MONTH = <yyyymm>; /*(T) Last year and month of in the */
/* form YYYYMM. */
/*-------------------------------------------------------------*/
/* 1-E-viii. CV DATA ONLY FOR U.S. SALES */
/* */
/* If you type COST_TYPE = CV above in Section 1-E-iii */
/* because you do NOT have cost data coming from the CM */
/* program, complete the following sections: */
/* */
/* 1-E-iv-ii. CV DATA ONLY FOR U.S. SALES */
/* 1-E-iv-iii. SURROGATE COSTS FOR NON-PRODUCTION */
/*-------------------------------------------------------------*/
%LET COST_DATA = < >; /*(D) Cost dataset name */
%LET COSTBARCODE = < >; /*(T) Bar code number(s) of cost */
/* dataset(s) used in this program. */
%LET COST_MATCH = < >; /*(V) The variable (usually CONNUM) */
/* linking cost data to sales data. */
%LET COST_QTY = < >; /*(V) Production quantity */
/* Note: Specify a Cost manufacturer if there is also a manufacturer */
/* reported in the U.S. sales. */
/* */
/* If applicable, the cost manufacturer variable will be identified */
/* in the cost data file. This occurs in cases where the respondent */
/* is reporting the costs for a manufacturer of the merchandise under */
/* consideration that is not collapsed with the respondent. If there */
/* is no cost manufacturer variable included in the cost database, */
/* use "NA". */
/* */
/* The cost manufacturer variable identifies the respondent and any */
/* manufacturer other than the respondent that is not collapsed with */
/* the respondent. This is different from those instances where a */
/* respondent has more than one producing entity and we consider the */
/* producing entity to be part of the respondent (i.e., the producing */
/* entities are collapsed with the respondent). In such instances, */
/* the respondent may submit a cost data file for each producing */
/* entity, and we will weight-average those costs. */
%LET COST_MANUF = <NA>; /*(V) Manufacturer code. If not */
/* applicable, type "NA" (without */
/* quotes). */
/* Note: Specify a Cost prime variable if there is also a prime */
/* variable reported in the U.S. sales. */
%LET COST_PRIME = <NA>; /*(V) Prime code. If not applicable, */
/* type "NA" (without quotes). */
/*---------------------------------------------------------*/
/* 1-E-ix. SURROGATE COSTS FOR NON-PRODUCTION */
/* */
/* Complete the following section if you have products */
/* that were sold but not produced during the period, */
/* and those products do not already have adequate */
/* surrogate cost information reported. */
/*---------------------------------------------------------*/
%LET MATCH_NO_PRODUCTION = <YES/NO>; /*(T) Find surrogate costs for products*/
/* not produced during the POR? */
/* Type "YES" or "NO" (without */
/* quotes). If "YES," complete */
/* the indented macro variables */
/* that follow. */
%LET COST_PROD_CHARS = <YES/NO>; /*(T) Are the product physical */
/* characteristic variables in the */
/* cost database? Type "YES" or */
/* "NO" without quotes). */
/* Note: For model matching to work, physical characteristic variables */
/* need to be defined as all character or all numeric. Physical */
/* characteristic variable values need to be all numeric. */
%LET COST_CHAR = < >; /*(V) Product matching characteristics */
/* in cost data. List them from */
/* left-to-right in order of */
/* importance, with no punctuation */
/* separating them. Do not surround */
/* the values with quotes. */
/*------------------------------------------------------------------*/
/* 1-F: CONDITIONAL PROGRAMMING OPTIONS: */
/*------------------------------------------------------------------*/
%LET LOT_ADJUST = <NO/HM/INPUT>; /*(T) Type "NO" (without quotes) when */
/* not making an LOT adjustment. Type */
/* "HM" (without quotes) if using */
/* info. from CM sales. Type "INPUT" */
/* (without quotes) if using info. */
/* from a source other than CM sales. */
/* If you typed "INPUT," then also */
/* complete Section 7-A-i below. */
%LET CEPROFIT = <CALC/INPUT>; /*(T) If there are CEP sales, type "CALC" */
/* (without quotes) to use CM and U.S. */
/* expense and revenue data. Type */
/* "INPUT" (without quotes) to supply */
/* an alternative CEP profit rate */
/* when not calculating the same. If */
/* there are not CEP sales, skip */
/* filling in the macro variable */
/* CEPROFIT. */
%LET CEPRATE = < >; /*(T) If you typed "LET CEPROFIT=INPUT" */
/* directly above, the alternative */
/* CEP profit rate in decimal form. */
%LET ALLOW_CEP_OFFSET = <YES/NO>; /*(T) Allow CEP offset? Type "YES" or */
/* "NO" (without quotes). If there are */
/* no CEP sales, type "NO" (without */
/* quotes). */
%LET CVSELL_TYPE = <CM/OTHER>; /*(T) Type "CM" (without quotes) when */
/* using CM selling & profit info. */
/* Type "OTHER" (without quotes) */
/* if using info. from a source */
/* other than CM sales. If you typed */
/* "OTHER," then also complete section */
/* 9-A below. This macro variable is */
/* required only if you will have CV */
/* comparisons. */
%LET PER_UNIT_RATE = <YES/NO>; /*(T) Only print per-unit (and not ad */
/* valorem) cash deposit and, if */
/* applicable, assessment rates even */
/* when entered values are reported? */
/* Type "YES" or "NO" (without quotes) */
/*------------------------------------------------------------------*/
/* 1-G: FORMAT, PROGRAM AND PRINT OPTIONS */
/*------------------------------------------------------------------*/
/*-------------------------------------------------------------*/
/* 1-G-i Options that usually do not require edits. */
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
/* 1-G-i-a Printing Formats */
/* */
/* In sections where a large number of observations may */
/* print, the program limits the number of observations */
/* to 25, by default. To change this, adjust the PRINTOBS */
/* number below. */
/* */
/* By editing the default formats used below, you can */
/* change the way values are displayed when the formats */
/* are used. When you increase the number of decimals */
/* (the number to the right of the decimal in the format), */
/* you must also increase the maximum number of places */
/* displayed, which is the number to the left of the */
/* decimal. (Commas, decimal points, dollar signs, percent */
/* symbols, etc. all occupy space.) For example, the */
/* COMMA12.2 format looks like '1,000,000.00' To display */
/* four decimal places you would type "COMMA14.4" */
/*-------------------------------------------------------------*/
%LET PRINTOBS = 25; /*(T) Number of obs to print on */
/* statements that are sampled. */
%LET COMMA_FORMAT = COMMA12.2; /* Comma format using 12 total */
/* spaces and two decimal places. */
%LET DOLLAR_FORMAT = DOLLAR12.2; /* Dollar format using 12 total */
/* spaces and two decimal places. */
%LET PERCENT_FORMAT = PERCENT8.2; /* Percent format using seven total */
/* spaces and two decimal places. */
/*----------------------------------------------------------*/
/* 1-G-i-b Programming Options */
/*----------------------------------------------------------*/
%LET DEL_WORKFILES = NO; /*(T) Delete all work library files? Default */
/* is NO. If you type "YES" (without */
/* quotes), you may increase program speed, */
/* but will not be able examine files in */
/* the work library for diagnostic purposes. */
%LET CALC_RUNTIME = YES; /*(T) Calculate program run time? If you don't */
/* like to see this info., type "NO" (without */
/* quotes) */
OPTION NOSYMBOLGEN; /* SYMBOLGYN prints macro variable resolutions. */
/* Reset to "NOSYMBOLGEN" (without quotes) to */
/* deactivate. */
OPTION MPRINT; /* MPRINT prints macro resolutions, type */
/* "NOMPRINT" (without quotes) to deactivate. */
OPTION NOMLOGIC; /* MLOGIC prints additional info. on macros, */
/* type "MLOGIC" (without quotes) to activate. */
OPTION MINOPERATOR; /* MINOPERATOR is required when using the IN(..) */
/* function in macros. */
OPTION OBS = MAX; /* Indicates the number of OBS to process in each */
/* data set. Default setting of MAX processes all */
/* transactions. If you have large datasets and */
/* initially wish to debug the program using a */
/* limited number of transactions, you can reset */
/* this option by typing in a number. */
OPTION NODATE; /* Suppresses date in header */
OPTION PAGENO = 1; /* Restarts page numbering at Page 1 */
OPTION YEARCUTOFF = 1960; /* Specifies the first year of a 100-year span that */
/* is used to read a two-digit year */
OPTION SPOOL; /* Aids finding location of syntax error in macros */
OPTION VARINITCHK = ERROR; /* An uninitialized variable will generate an ERROR */
OPTION FORMCHAR = '|----|+|---+=|-/\<>*'; /* For printing tables */
/*------------------------------------------------------------------*/
/* 1-H: GENERATE PROGRAM-SPECIFIC TITLES, FOOTNOTES */
/* AND MACROS NEEDED TO EXECUTE THE PROGRAM. */
/*------------------------------------------------------------------*/
%LET SALESDB = USSALES;
/*%G1_RUNTIME_SETUP*/
%G2_TITLE_SETUP
%G3_COST_TIME_MVARS
/*----------------------------------------------------------------------*/
/* 1-I: PRIME AND MANUFACTURER MACROS AND MACRO VARIABLES */
/* */
/* */
/* In the programming language, the macro variables &USPRIM, */
/* &SALES_COST_MANF (for merging sales with costs), &USMANF */
/* (for merging U.S. sales with CM sales for P2P comparisons), */
/* &HMPRIM, &HM_P2P_MANF and &CVMANF are used. Their values */
/* are determined by the answers in Sect. 1-E above. */
/* */
/* If you type %LET USMANUF=NA, then the manufacturer-related */
/* macro variables for U.S. sales (&US_COST_MANF and &USMANF */
/* will be set to null/blank values. Since you need manufacturer */
/* designations in both U.S. & CM sales for them to merge by */
/* manufacturer, &HM_P2P_MANF will also be set to a null/blank */
/* value. Similarly, &COST_MANF will be set to null/blank values */
/* if %LET USMANUF=NA. Otherwise, &US_COST_MANF and &USMANF */
/* will be set to the variable indicated by %LET USMANUF=<???> */
/* when manufacturer is also relevant for cost and CM sales, */
/* respectively. */
/* */
/* If you type %LET HMMANUF=NO, then &HM_P2P_MANF will be set to */
/* a null/blank value as will &USMANF. Otherwise, &HMMANF */
/* will be equal to HMMANF, the standardized variable name */
/* assigned in the CM program, as long as U.S. manufacturer is */
/* also relevant. */
/* */
/* Similarly, &USPRIM and &HMPRIM will be set to null/blank values */
/* if you type either %LET USPRIME=NA or %LET HMPRIME=NA. */
/* Otherwise, they will be set to the variables indicated in */
/* %LET USPRIME=<???> and %LET HMPRIME=<???> when prime is */
/* relevant for both U.S. and CM sales. */
/*----------------------------------------------------------------------*/
%US1_MACROS
/***************************************************************************/
/* PART 2: BRING IN U.S. SALES, CONVERT DATE VARIABLE, IF NECESSARY, MERGE */
/* EXCHANGE RATES INTO SALES, IF REQUIRED. */
/***************************************************************************/
/*----------------------------------------------------------------------*/
/* 2-A: BRING IN U.S. SALES DATA */
/* */
/* Alter the SET statement, if necessary, to bring in more */
/* than one SAS database. If you need to rename variables, */
/* change variables from character to numeric (or vice versa), */
/* in order to do align the various databases, make such */
/* changes here. */
/* */
/* Changes to U.S. data using exchange rates and costs should */
/* wait until Part 4, below, after the cost and exchange rate */
/* databases are attached. */
/* */
/* Leave the data step open through the RUN statement */
/* following the execution of the US2_SALETYPE macro in */
/* Sect. 2-E. */
/*----------------------------------------------------------------------*/
DATA USSALES;
SET COMPANY.&USDATA;
&USSALEDATE = FLOOR(&USSALEDATE); /* Eliminates the time part of sale date when defined as a datetime variable. */
/* <Selectively adjust sale date based on an earlier date variable.> */
%DEFINE_SALE_DATE (SALEDATE = &USSALEDATE, DATEBEFORESALE = &USDATEBEFORESALE, EARLIERDATE = &USEARLIERDATE);
/*------------------------------------------------------------------*/
/* 2-B: Insert and annotate any changes below. */
/*------------------------------------------------------------------*/
/* <Insert changes here, if required.> */
/*---------------------------------------------------------------------*/
/* 2-C: LEVEL OF TRADE */
/* */
/* The variable USLOT will be created containing the levels */
/* of trade. It is this variable that is used in the */
/* programming. If you typed '%LET USLOT = NA' in */
/* Sect. 1-E-ii above, the variable USLOT will be set to 0 */
/* (zero). Otherwise, USLOT will be set equal to the variable */
/* specified in %LET USLOT = <???>. */
/* */
/* If you have a level of trade variable and need to make */
/* changes to its values, or you do not have one but need to */
/* create one, make those edits before the G4_LOT. */
/*---------------------------------------------------------------------*/
%G4_LOT(&USLOT,USLOT)
/*---------------------------------------------------------------------*/
/* 2-D: CREATE U.S. SALE TYPE PROGRAMMING VARIABLE */
/* */
/* The variable SALE_TYPE will be created, indicating whether U.S. */
/* sales are EP or CEP. It is this variable that will be used in */
/* the programming language. If there is a variable already in */
/* the data and you typed %LET SALETYPE={{variable name}} in */
/* in Sect. I-E-ii above, SALE_TYPE will be set equal to that */
/* variable. If no variable exists in the reported data, */
/* SALE_TYPE will be set equal to "EP" if you typed */
/* %LET SALETYPE=EP, or "CEP" if you typed %LET SALETYPE=CEP. */
/*---------------------------------------------------------------------*/
%US2_SALETYPE
/*------------------------------------------------------------------------*/
/* 2-E: CREATE THE U.S. QUARTER VARIABLE IN QUARTERLY COST CASES, AND */
/* THE U.S. YEARMONTH VARIABLE IN HIGH INFLATION COST CASES. */
/*------------------------------------------------------------------------*/
%CREATE_QUARTERS(&USSALEDATE, MARGIN) /* Assigns quarters to US sales based on */
/* the date of sale variable and the */
/* first day of the POR/POI. The */
/* values will be '-1', '0', '1', etc. */
%CREATE_YEAR_MONTH(&USSALEDATE, US) /* In high inflation cases creates the */